Disabling WP-Cron

You are here:
Estimated reading time: 1 min

About this Article

This article describes the process for disabling WP-Cron in order in increase WordPress performance and save on CPU.

Why Disable WP-Cron?

In order to check for updates to WordPress Core, Themes and Plugins, WordPress uses a Cron Task to check if any updates are available. It does this by making a request to the core – but it doesn’t fire on a schedule. Instead it fires when your website is accessed.

This can cause performance issues, especially on traffic heavy sites by using lots of CPU and slowing down your hosting account.

To prevent this from happening, you can run the cron task as a scheduled task from your cPanel control panel and disable WP-Cron.

Disable WP-Cron

Go to your file manager or access your files by FTP. In the WordPress home directory look for your wp-config.php file and click to edit (normally right click and edit)

Add the following line of code to this file

define('DISABLE_WP_CRON', true);

Save your file.

Create a Cron Task

Now to add the cron task. You can follow the instructions on how to do this here.

Set the task to run 2 times per hour and use the following command

/usr/local/bin/php ~/public_html/wp-cron.php >/dev/null 2>&1

Be sure to change the public_html part of the above with your home directory. If you host with us it will be as above. If we’ve migrated your account it may be httpdocs. If you have WordPress in a directory i.e. mywebsite.com/blog, the this will be /public_html/blog/

This will fire the command to run wp-cron and improve your web site performance.

Was this article helpful?
Dislike 0
Views: 26