如果你需要更新某个置顶文章的发布时间可以通过wp_update_post函数来解决问题,这个函数还有很多其他的参数,基本上所有关于文章的信息都可以通过这个函数来进行更新,更多可以自行搜索该函数。
1 2 3 4 5 6 7 8 9 |
$time = current_time('mysql'); wp_update_post( array ( 'ID' => 123, // ID of the post to update 'post_date' => $time, 'post_date_gmt' => get_gmt_from_date( $time ) ) ); |
原文地址: https://wordpress.stackexchange.com/questions/97227/changing-the-post-date-and-time-with-function