Should I disable WP_CRON and instead trigger wp-cron.php from server every few mins?

There is no downside for running WP CRON using the server’s cron jobs. In fact this is the recommended practice.

According to Official WordPress Plugin Development Document:

WP-Cron does not run continuously, which can be an issue if there are critical tasks that must run on time. There is an easy solution for this. Simply set up your system’s task scheduler to run on the intervals you desire (or at the specific time needed).

To do this, you need to first disable the default cron behaviour in wp-config.php:

define('DISABLE_WP_CRON', true);

Then, schedule wp-cron.php from your server. For Linux, that means:

crontab -e

However, instead of running it in Command Line (CLI), run it as an HTTP request. For that you may use wget:

*/5 * * * * wget -q -O - https://your-domain.com/wp-cron.php?doing_wp_cron

WordPress loads all the required core files, Plugins etc. in wp-cron.php with the following CODE:

if ( !defined('ABSPATH') ) {
    /** Set up WordPress environment */
    require_once( dirname( __FILE__ ) . '/wp-load.php' );
}

So don’t worry about WordPress not loading important features.

Leave a Comment