查看内部的文件文档wp-cron.php
看来完全可以打电话$ php wp-cron.php
:
/**
* A pseudo-CRON daemon for scheduling WordPress tasks
*
* WP Cron is triggered when the site receives a visit. In the scenario
* where a site may not receive enough visits to execute scheduled tasks
* in a timely manner, this file can be called directly or via a server
* CRON daemon for X number of times.
*
* Defining DISABLE_WP_CRON as true and calling this file directly are
* mutually exclusive and the latter does not rely on the former to work.
*
* The HTTP request to this file will not slow down the visitor who happens to
* visit when the cron job is needed to run.
*
* @package WordPress
*/
您还可以在命令行上执行以下操作
wp-cli 为此。
$ cd /path/to/wordpress
$ wp cron event run --due-now
要强制触发一个独立于其设置的计划运行的cron,请执行以下操作:
$ wp cron event run my_custom_cron_event
或者作为一个用于crontab的一行程序,每小时+15分钟运行一次(下午2:15、下午3:15、下午4:15等):
15 * * * * cd /path/to/wordpress && wp cron event run --due-now > /dev/null 2>&1