Add a cPanel "Real" cron to control WordPress Cron jobs
WordPress runs it's crons every time the page is loaded causing many issues. By disableing this eature in WordPress
and using cPanel to run these crons on a schedule will make your site more reliable and perform better
Benifits:
- Avoid multiple instances of WP-Cron running on your website,
- Full control of when the WP-Cron function runs.
- Reduces the server load for improved site performance
Steps to disable internal WP Cron:
1. Disable internal WP-Cron function
Open the wp-config.php file in NotePad or the editor of your choice and add the two lines below.
//Disable internal Wp-Cron function
define('DISABLE_WP_CRON', true);
This will stop the WordPress internal cron function from running.
2. Setup a cron function from your cPanel
Access your cPanel
The link is http://yourwebsite.com/cpanel
Once your enter your user id and password and enter the control panel, type cron in the search area and select "Cron Jobs"
or scroll down to the "Advanced section" then click the "Cron Jobs" Icon.
On the new page you would find an "Add New Cron Job" section,
From the Common Settings drop down field, select "Once Per Day(0 0 * * *)".
Once you select this, the rest of the fields will be automatically filled with the necessary information.
In the command field, add the below line. Remember to add your website address.
wget http://your-website.com/wp-cron.php?doing_wp_cron=1 > /dev/null 2>&1
Finally, click on the "Add New Cron Job" button.
From now on the server will make a request for the wp-cron.php file once every 24 hours.
TIP: You can run the cron more or less often as desired, we suggest 24 hours for optimal performance