我正在寻找一个可以更新已发布的 WordPress 帖子摘录的功能。该函数wp_update_post()不更新摘录。我研究的其他功能the_excerpt()仅用于获取摘录而不是设置它。
如何更新 WordPress 中已发布帖子的摘录?
wp_update_post()应该是使用的选择。
您可以post_excerpt在 $args 中定位 , 以解决帖子摘录。
一个(未经测试,但应该有效)示例:
$the_post = array(
'ID' => 37,//the ID of the Post
'post_excerpt' => 'This is the updated excerpt.',
);
wp_update_post( $the_post );
Run Code Online (Sandbox Code Playgroud)
这是一个非常不动态的例子,但应该给出如何去做的想法。
| 归档时间: |
|
| 查看次数: |
1922 次 |
| 最近记录: |