WordPress Cron File (wp-cron.php) Fix

WordPress uses a file called “wp-cron.php”. It is a virtual cron job (a scheduled task on the server), and is used by WordPress to in order to automate commands that need to happen certain times of the day, week, etc. These tasks may be checking for WordPress updates, sending email notifications, etc.

WordPress is setup so that the wp-cron.php file runs everytime someone (a real person) or something (a search engine bot) visits your WordPress website. This cron job can take a minute or so to run, depending, on the size of the website. If your website doesn’t have a lot of visitors, it may not be an issue. If there are several visitors at once (or, if a search engine bot comes to index your site for search rankings), the resource usage on the server can increase exponentially in a very short amount of time.

What can be done to maximize the efficiency of the WordPress cron jobs? You can tell the WordPress installation that you’re going to handle the execution of the wp-cron.php file. Here’s how:


1) Open the wp-config.php file in your WordPress installation. (If you’re using cPanel’s File Manager, select “Code Editor”.)
2) Disable the cron job by going to the bottom of the database settings in that file and adding the following line:

define('DISABLE_WP_CRON', true); //Disable page load cron

3) Click “Save”.


In this example, we’re setting it up to run one time every six hours.

1) Login to cPanel
2) Find the box titled “Advanced”, then click on the “Cron jobs” icon.
3) In the “Add New Cron Job” area, click the “Common Settings” drop-down menu select the option for “Once an hour”.
4) In the “Hour” drop-down menu, select “Every 6 hours”.
5) In the “Command” field, type in the following:

/usr/bin/php -q  /PATH/TO/WP-CRON.PHP > /dev/null

6) Click the “Add New Cron Job” button.

This will help your WordPress site/blog to run faster, as well as help the server its hosted on be more efficient.