Last modified by M. Dara Duman - 7 months ago
1 min read

How to enable or disable WP Cron?

WP Cron is a WordPress function which runs unattended scheduled tasks. To enable WP Cron, go to the directory where your wp-config.php is and and add:

define('DISABLE_WP_CRON', false);

anywhere above the /* That's all, stop editing! Happy blogging. */

If you need to disable WP Cron for any reason, just set "DISABLE_WP_CRON" to true as shown below:

define('DISABLE_WP_CRON', true);

WP cron runs when a visitor comes to your site. If you did not have a visitor in the last hour, the tasks scheduled with WP Cron never kicks off. We recommend using operating system based cron or external ping service if you do not have an active site or if you own a server with many WordPress websites hosted.

To be able run WP Cron externally, follow the steps below:

  1. Disable WP Cron.

    define('DISABLE_WP_CRON', true);

  2. Create a operating system based Cron Job. For example, the following runs every 5 minutes in a linux based system.

    */5 * * * curl --silent "" > /dev/null 2>&1

  3. Test to make sure everything works as expected
Was this information helpful?