US 1-877-412-4678      International 1-317-961-1116
There are upcoming maintenance events which may impact our services. Learn more

How to replace WordPress cron job with a cPanel managed cron job. Print

  • WordPress, Cron, Performance, Optimization
  • 16

The WordPress cron system handles scheduled tasks that your website and plug-ins require to function. By design the creators of WordPress handle the cron system internally processing these scheduled tasks with every page load. Due to this the WordPress cron feature is open to outside DDoS attack and performance issues due to how frequently it runs. In most cases it is suggested you modify the WordPress script and use the cPanel cron system instead.


Softaculous now offers a one-step solution to shifting the cron job from Wordpress to cPanel without the need to manually edit the config file. Simply log into your cPanel, then select "Wordpress Manager by Softaculous" from the left-hand menu.

From there, select the down arrow next to the installation you need to change the cron on, then change the option for Wordpress Cron from Enabled to Disabled.

Once you have made the change you should see a small confirmation banner in the lower right letting you know the change has been saved. Once you see that, you are all set!


If you happen to be on a VPS server without Softaculous or wish to manually make the cron job change, simply follow the directions below.


Before we add the cPanel cron job you will need to edit your WordPress 'wp-config.php' file and disable the internal cron system. This article uses the cPanel File Manager to edit and make the required change to the 'wp-config.php' file. 

First you will need to access your accounts cPanel interface and locate the 'File Manager' section. You can use the search box at the top of the cPanel interface to find the File Manager. 

When you are inside the 'File Manager' you will need to locate your 'wp-config.php' file, for most clients this is located within the public_html directory. If this is an add-on domain you will need to navigate to your website document directory where the WordPress files are located. You would click on the 'wp-config.php' file once and then use the 'Edit' button at the top to open the file. 


When the file is open for editing you will need to add the following code in the location outlined in the image below. Remember to click 'Save Changes' once the code is added to the file. 

define('DISABLE_WP_CRON', true);

After saving the changes to the 'wp-config.php' file it is now time to add the cPanel cron job. Go to the cPanel interface home page and locate the 'Cron Jobs' section. 

In the 'Add New Cron Job' section you would first select 'Twice Per Hour (0,30 * * * *)' under the 'Common Settings' drop-down.  You can set a higher frequency although we do not recommend faster than once every 5 minutes.

You then add the following text in the box under the 'Command:' section. Please note if your site is not in public_html you will enter the folder name where the site is located.  You can find the path for every domain in your cPanel in the 'Domains' section.

php -q ~/public_html/wp-cron.php > /dev/null

After clicking 'Add New Cron Job' the process is complete. 




Was this answer helpful?

« Back