使用WordPress常用函数 wp publish post 发布文章
函数描述
通过更新文章状态设置文章为发布状态,相当于点击了后台的发表按钮。
注意:此函数除了修改文章状态,不做其他任何操作,如果想检查是否设置了文章标题,请使用 wp_update_post()。
使用方法
<?php wp_publish_post( $post_id ) ?>
参数
$post_id
(integer) (必需) 文章ID。
默认:None
返回值
(null)
原文来自:一刀
通过更新文章状态设置文章为发布状态,相当于点击了后台的发表按钮。
注意:此函数除了修改文章状态,不做其他任何操作,如果想检查是否设置了文章标题,请使用 wp_update_post()。
<?php wp_publish_post( $post_id ) ?>
$post_id
(integer) (必需) 文章ID。
默认:None
(null)
原文来自:一刀