wordpress插件-如何更改发布日期时间? [英] wordpress plugin - how to change the post date time?
本文介绍了wordpress插件-如何更改发布日期时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个插件,需要更改发布日期时间.我应该使用什么WP功能来做到这一点?
I have a plugin that I need to change the post date time. What WP function should I use to do this?
谢谢
推荐答案
您希望将wp_update_post($post)
与新的post_date
值配合使用-
You would want to use wp_update_post($post)
with a new post_date
value - http://codex.wordpress.org/Function_Reference/wp_update_post
$mypost = array();
$mypost['ID'] = 111; // the post ID you want to update
$mypost['post_date'] = $your_date; // uses 'Y-m-d H:i:s' format
wp_update_post($mypost);
这篇关于wordpress插件-如何更改发布日期时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文