Can you just trigger wp-cron.php using for example $ php /path/to/wordpress/wp-cron.php rather than going through the wget method using for example wget -q -O - http://example.com/wp-cron.php>/dev/null 2>&1?

  • Question is: Why would you want/need to do it that way?
    – leymannx
    Commented Mar 25, 2019 at 20:22
  • 2
    @leymannx for many reasons, maybe your system does not have wget? Cron type of tasks should not require web layer anyway and you should be able to run cron even without the whole site being up. Commented Sep 27, 2019 at 11:01

2 Answers 2


Looking at the file documentation inside wp-cron.php it seems it's absolutely possible to just call $ 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

What else you can do on the command line, is to use wp-cli for that.

$ cd /path/to/wordpress
$ wp cron event run --due-now

To force-trigger one single cron independent from its set schedule run:

$ wp cron event run my_custom_cron_event

Or as a one-liner to be used in a crontab to run every full hour + 15 minutes (2:15 pm, 3:15pm, 4:15pm etc.):

15 * * * * cd /path/to/wordpress && wp cron event run --due-now > /dev/null 2>&1
  • 1
    Is there a benefit to using curl versus the wp cli tool? Commented Jan 26, 2020 at 6:06
  • 2
    @BarryChapman – Curl basically is just another page request. So it may potentially slow the site down a bit when the cron runs.
    – leymannx
    Commented Jan 26, 2020 at 15:56
  • 2
    @BarryChapman I guess that any code that depends on $_SERVER or other session variables will not like being called from the command line. Other than that you should be fine
    – alexg
    Commented Mar 4, 2021 at 17:29
  • 1
    It is worth to mention, that wp-cli runs cron via HTTP. It is not definitely same as calling wp-cron from CLI PHP, because for example max_execution_time can affect the cron runs. If you have issues with timeouting cron tasks, I'd recommend to call the wp-cron.php directly, without involving wp-cli. Commented Mar 15, 2023 at 9:40
  • @GaborGarami wp-cli does an http request out of the command line?? 🧐
    – leymannx
    Commented Mar 16, 2023 at 10:42

Yes, it's possible to trigger cron runs with just $ php /path/to/wordpress/wp-cron.php.

Alternatively you can use curl:

*/10 * * * * curl http://example.com/wp-cron.php > /dev/null 2>&1

And you can add the following line to your wp-config.php to disable crons being run from HTTP requests:

define('DISABLE_WP_CRON', true);
  • If you are using curl that's still an HTTP request so probably not a good idea to DISABLE_WP_CRON? Commented Jul 10, 2020 at 8:20
  • 1
    @Bananaapple – By calling wp-cron.php directly you circumvent that. But at the same time DISABLE_WP_CRON prevents that cron is triggered from visitors browsing any page of your site. See kinsta.com/knowledgebase/disable-wp-cron and in the file comments in my answer above 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.
    – leymannx
    Commented Jul 10, 2020 at 8:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.