论坛首页 › 论坛 › 寻求帮助 › 求WordPress 批量更新下已定时文章数据库语句 › 回复至:求WordPress 批量更新下已定时文章数据库语句
2021年7月20日 上午1:31
#20927
以下代码是将所有定时文章延长8小时执行,你想具体延时多少就把秒数改一下。
$args = array( 'post_status' => 'future', ); $query = new WP_Query( $args ); foreach ( $query->posts as $post ) { wp_clear_scheduled_hook( 'publish_future_post', array( $post->ID ) ); wp_schedule_single_event( strtotime( $post->post_date ) + 28800, 'publish_future_post', array( $post->ID ) ); }
以后提问千万把问题描述清楚,否则不利于搜索引擎索引,尤其是对于这种需要定制代码来实现的需求就使得付出的成本和收到的回报相差颇多了。