WordPress Cron and How to Control It

Cron Jobs or Cron is a system which allows you to schedule a task or event to be performed at a fixed interval of your choice (every day, hour or minute). For a WordPress website for example, a cron is useful for scheduling a new post to be published at a date and time of your choice.

Most cron jobs have to be manually configured in your cPanel > Cron Jobs page but if you run a WordPress website, WordPress runs their cron very differently. With WordPress, the cron is executed every time someone access a non-cached version of your website instead of at a fixed interval.

What is the problem?

As a result of the way the WordPress Cron (wp-cron.php) is designed, you can face two possible issues:

  • If the cron runs too often, your website can experience performance issues or high CPU usage.
  • If the cron runs not often enough, some events or tasks may not run so your scheduled post may not be published.

As the WordPress Cron is being invoked every time someone access a non-cached page or WordPress Admin, it will also slow down your page load quite a bit (depending on the amount of type of plugins you use) which is not ideal.

What can be done about it?

You can control the problem by disabling the built-in WordPress Cron and instead create a real Cron Job in your cPanel.

There are two ways to do it, one via our WordPress Manager tool in your cPanel and the other being the manual method:

Disable WordPress Cron with WordPress Manager

You can disable the built-in WordPress Cron and replace it with a real Cron Job in cPanel with just a few clicks using the WordPress Manager tool we provide in your Hypercharged Cloud Hosting plan.

Step #1: Navigate to WordPress Manager in cPanel

Login to your cPanel and click the WordPress Manager icon.

Click on the Expand icon to view more details about your WordPress website:

If you don’t see your website listed in the WordPress Manager, you will need to click the Scan button to import your existing website into WordPress Manager.

Step #2: Click a Radio or Option Button

Look for the WordPress Cron (wp-cron.php) option and click the Disabled radio / option button:

WordPress Manager will disable the built-in WordPress Cron and create a real Cron Job in cPanel with 30 minutes interval which should be good enough for most websites.

You can modify the interval or the Cron Job at anytime in your cPanel > Cron Jobs page if you need it to be more frequent (only do this if you need it, otherwise leave it as default).

Disable WordPress Cron Manually

Step #1: Disable WordPress Cron

Go to your cPanel File Manager, find and open up your wp-config.php file and add the following line right after the <?php line (it can be above or below the define( 'WP_CACHE', true ); line:

define('DISABLE_WP_CRON', true);

Step #2: Add a Cron Job in cPanel

Login to your cPanel, navigate to the Cron Jobs page and add a Cron Job to access the wp-cron.php page.

For the Common Settings, select Twice Per Hour (0,30 * * * *).

For the Command, input the following (replace yourdomain.com with your actual domain):

wget -q -O - https://yourdomain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1

If you are running a WordPress Multisite setup, use the following Command instead:

cd public_html && /usr/local/bin/php /usr/local/bin/wp site list --field=url | xargs -i -n1 /usr/local/bin/php /usr/local/bin/wp cron event run --due-now --url="{}"

And you’re done! The WordPress Cron should now run automatically every 30 minutes instead of on every page load, thus saving you possible issues of it running too often or not often enough.