1. Home
  2. WordPress & websites
  3. How do I disable wp-cron for my WordPress installation?

How do I disable wp-cron for my WordPress installation?

This guide is for advanced users.

Wp-cron is used instead of “proper cron” for WordPress installations. The purpose of wp-cron is to handle automations, such as scheduled publication of content, running checks for updates, etc. Wp-cron can, however, cause a problem. The function is called at every page load, so if the site is well-visited, quite large, and/or complex, it may negatively affect page load speeds drastically.

In this guide, we’ll show you how you can increase performance on your site by deactivating wp-cron and instead use proper cron (which is run at set times, independent of visits on the site itself).

Edit wp-config.php

The first step is to disable wp-cron, which is done by adding a line to the settings file for WordPress: wp-config.php.

Hence, edit the file wp-config.php associated with your WordPress installation. By default it resides in the document root for the site. You can use the File Manager through cPanel to edit the file, or by using SSH or FTP. In the latter case, download the file, edit it, and reupload it, overwriting the old file.

Find the line

/* That's all, stop editing! Happy publishing. */

Above that line, enter the following:

define('DISABLE_WP_CRON', true);

This tells WordPress to disable wp-cron.

Create a cron job

At this moment, no automatic functions on your WordPress installation will work, so you need to set up a cron job as soon as possible. We have written the following general guide about how to set up cron jobs on web hosting accounts with us.

We recommend that you set the cron job to trigger every five to 15 minutes, and the command you should use is:

wget -O /dev/null -o /dev/null "https://exempel.se/wp-cron.php?doing_wp_cron" > /dev/null 2>&1

Swap out https://exempel.se to what is correct for your site’s domain. (Also correct https to http if you’re not using https. We always recommend using https though.)

Once you’ve saved the cron job, automations on your site will be managed by cron on the server, instead of wp-cron, which should reduce the site’s impact on the server – making the site run faster.

Was this article helpful?

Related Articles