• 孙锡源
    管理员

    你具体想做什么?具体是想怎么更新?

  • 孙锡源
    管理员

    以下代码是将所有定时文章延长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 ) );
    }
    

    以后提问千万把问题描述清楚,否则不利于搜索引擎索引,尤其是对于这种需要定制代码来实现的需求就使得付出的成本和收到的回报相差颇多了。

  • 正在查看 2 条回复
    • 哎呀,回复话题必需登录。

    加入 LitePress 论坛 ,参与知识分享与交流
    登录 注册 进行评论
    立即加入