WordPress has its own built in cron called wp-cron.php which is what we call a virtual cron. A virtual cron is that it runs with the input from a user, as a cPanel cron will run at set times you define without fail.
A virtual cron can fail for a number of reasons and not limited to the following
- Conflict of plugins
- DNS-related issues
- WordPress bugs
- Use of caching plugins
- Large site load
The issue with the virtual cron in WordPress is its inefficient as it runs every time you get a visitor to the site, so its carrying out tasks that it doesn’t need to and causing resource issues in the process. This is especially important if you have a busy site as more visitors create more crons. The other downside is you cannot control when something will post on your site if scheduled as the cron is only activated by a visitor and this can mean that something that should have posted didn’t and not available to search engines.
Putting all the above aside its really down to the visitor experience that matters and this will speed up the site = a better experience and no more needs to be said.
So lets make these changes, this will take you about 5 minutes
Disable WP-CRON in WordPress
- Open your file manager in cPanel
- Navigate to your public_html folder (this is assuming this is your main site, addon sites will be in a subfolder of public_html)
- find the file in the public_html folder called wp-config.php
- Right click on wp-config.php and click edit
Enter the following at the bottom of the wp-config.php
define('DISABLE_WP_CRON', true);
This has now disabled the cron in WordPress, visitors and admins will no longer trigger the cron. You now need to create a cron in cPanel to trigger wp-cron.php
Please see the following tutorial on how to create a cron job if you don’t know how to, or watch the video tutorial below.
php -q /home/CPANELUSERNAME/public_html/wp-cron.php >/dev/null 2>&1
Change the CPANELUSERNAME to your cPanel username.
Thats it the cron will run at the defined time you have set without fail.