测速网在维护一个企业站时文章通常都是定时发布一周或是半月的文章,但是到了下次维护时发现定时文章都失败了。
搜索了一下相关的文章方法,失败的原因是由于wp设定的发布时间是0.01,所以主机可能速度上出现了异常导致失败,总之是一个很微妙的点。
方法一:修改程序文件函数
wordpress程序根目录下wp-includes 目录下的 cron.php文件
可以通过文件搜索timeout,第二个timeout内容如下
area data-settings="dblclick" readonly >$cron_request = apply_filters( 'cron_request', array('url' => add_query_arg( 'doing_wp_cron', $doing_wp_cron, site_url( 'wp-cron.php' ) ),'key' => $doing_wp_cron,'args' => array('timeout' => 0.01,'blocking' => false,'sslverify' => apply_filters( 'http_local_ssl_verify', true ))) ); wp_remote_post( $cron_request['url'], $cron_request['args'] );area>123456789101112$cron_request = apply_filters( 'cron_request', array('url'=> add_query_arg( 'doing_wp_cron', $doing_wp_cron, site_url( 'wp-cron.php' ) ),'key'=> $doing_wp_cron,'args' => array('timeout' => 0.01,'blocking'=> false,'sslverify' => apply_filters( 'http_local_ssl_verify', true ))) ); wp_remote_post( $cron_request['url'], $cron_request['args'] );
将里面0.01修改成10.00或者其他数字都行。
方法二:安装相关插件
有多很好的插件值得推荐,在这里推荐下测速网使用的WP Missed Schedule这个插件,无需设置安装启用即可。
总结,如果对于不太懂代码操作的新玩家,还是推荐用插件来得保险些!