Disabling the wp-cron.php in WordPressWritten by Tim Sisson
Whenever someone visits your website, the wp-cron.php will run. This can be taxing to the server, especially if your website gets a lot of traffic. The cron really only needs to run when you make updates, so disabling its natural behavior to run every time a visitor comes to your website can be helpful in lowering your resource usage on the server.
Turning the wp-cron.php off
Disabling the Cron is easy. This is done by adding a line of code to your wp-config.php file.
- Open your wp-config.php file with the code editor in the cPanel File Manager
- Add the following line of code to the file:
The placement of this code in the wp-config file is important, we suggest placing it under the definition of your database settings, as in:
/** MySQL database username */
- Click Save
At this point, the cron job will never run on the server.
Configuring cPanel to run the Cron
We still want the cron job to run, so we’re going to manually configure the server to run a cron job in cPanel and set the cron job to run every 3 hours. If you’re not updating content more than every 4 to 6 hours, this setting will be fine.
- Log into cPanel
- Click on the “Cron Job” icon
- Scroll down the page to the “Add New Cron Job”
- Click on the dropdown menu for “Hour:” and set to “Every 3 hours (*/3)”
- Go to the command field and enter in the following command:
cd /home/cpusrname/public_html; php -q wp-cron.php
Keep in mind, you’ll need to replace cpusrname with your actual cpanel username. Also, this is the path to the file. If you’re using an add-on domain, you’ll need to change the path to reflect it
- Click “Add New Cron Job”
If you need further assistance please feel free to ask a question on our support center.