Select Page

When WordPress is used to automate tasks such as publishing scheduled articles, checking for plugin or theme updates, sending email notifications and other tasks, it makes use of a file called wp-cron.php, which acts as a virtual cron job, or scheduled task.

WordPress is configured by default to call wp-cron.php every time someone visits your WordPress website while a scheduled job is active, essentially asking “is it time to do anything yet?”

On low-traffic websites, this is entirely acceptable; however, as your site’s traffic grows, checking for scheduled tasks several times can become inefficient and cause resource use issues for the server, which will in turn cause your website to load more slowly.

Disable the default behaviour of the wp-cron.php file.

With the wp-config.php file, we can easily instruct WordPress to allow us to handle the execution of the wp-cron.php script.

 

  1. Open the wp-config.php file in the cPanel File Manager Code Editor to make any necessary changes.
  2. Locate the database settings near the bottom of the wp-config.php file, which is normally around line 37. Insert the following code to disable WordPress’s cron:

          define(‘DISABLE_WP_CRON’, ‘true’);

3.Save your work by clicking Save.

With this change, WordPress will no longer automatically run the wp-cron.php script each time a new visitor comes to your site.