How to disable the wp-cron.php in WordPress

WordPress uses a file called wp-cron.php located in the root of the website as a virtual CRON Job (scheduled task) to automate things like publishing scheduled posts, checking for plugin or theme updates, sending email notifications, etc. By default, WordPress is set up to call wp-cron.php every time someone visits your WordPress website, which can be excessive.

On small/low traffic sites this isn't much of a problem, but when more visitors come to your website, checking multiple times for scheduled tasks can be very inefficient and lead to resource usage problems for the server, plus it will also make your website load slower.

In this quick guide, we will show you how to disable this feature and turn it into a normal CRON job that will run at defined times.

Step 1: Disabling the default wp-cron.php behaviour

We can tell WordPress to let us handle the execution of wp-cron.php with the wp-config.php file.

  1. Open your wp-config.php file with the cPanel File Manager Code Editor. The file is located at the root of your WordPress install.
  2. Go to the bottom of the database settings in wp-config.php
  3. Add the code below highlighted in red:

    /** The Database Collate type. Don't change this if in doubt. */
    define('DB_COLLATE', '');

    define('DISABLE_WP_CRON', true);

  4. Now click Save

Now WordPress will no longer automatically run the wp-cron.php script each time your site gets a visitor.

Step 2: Setup a manual CRON job for wp-cron.php

Now that the wp-cron.php is disabled we don't want to leave WordPress without any ability to automate tasks.

For most WordPress users having the wp-cron.php script run every 6 hours is enough to handle all tasks. That would be 4 executions in a day, compared to possibly hundreds, or even thousands if you had a lot of website traffic that day. If you have a lot of articles publishing a different times of the day, for instance, every hour then you will want to set the task to run hourly.

  1. Log into cPanel
  2. Click on CRON jobs icon (Under the Advanced section)
  3. Select Once per hour from the Common Settings drop-down
  4. Now select Every Sixth hours (*/6) from the Hour drop-down. If every 6 hours is too long to wait between tasks, consider using every hour to start with. You can always change this setting later.
  5. Fill in CRON job command, click add new CRON Job
  6. Finally fill in the code to run our CRON Job and click Add New Cron Job.
    cd /home/username/public_html; php -q wp-cron.php
    Important: Replace 'username' with your cPanel username.

Note: The path '/home/username/public_html' would be for a primary domain, if you're using an addon domain, or have WordPress installed in a sub-directory you'll want to be sure to update your path. For instance, if you have your WordPress site in a folder called blog under the public_html folder then your path would be '/home/username/public_html/blog'.

You should see that your new CRON Job was added successfully. Now your WordPress website should be safe running scheduled tasks via the wp-cron.php script, but only at set intervals.

If you require any support or would like us to handle this, just contact a member of the support team and ask them to perform this task for you.

  • WordPress, Performance
  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

How to Change Your Header in WordPress

This tutorial will teach you how to change your header in WordPress. You will need to be logged...

How to Manage Categories in WordPress

This tutorial will help you learn how to manage your categories in the WordPress program. You...

How to Manage Pages in WordPress

The purpose of this tutorial is to teach you how to manage pages in WordPress. You will need to...

How to Manage Users in WordPress

This tutorial will teach you how to manage users in your WordPress program. You will need to...

How to Manage Your Plugins in WordPress

This tutorial will teach you how to manage your plugins in WordPress. First you need to log in...