In WordPress, there’s a small file called wp-cron.php, which simulates normal cron-jobs. With the exception that this file isn’t executed every at a certain amount of minutes. Instead, WP-Cron will be executed each time someone visits your website.
How is WP-Cron affecting the performance of your website?
If your website is receiving a high amount of traffic, and the WP-Cron is executed on every visit, this will cause multiple processes that are executed, to run the cron.
How to disable WP-Cron in the wp-config.php
WP-Cron can be easily disabled by adding the following code snippet into your wp-config.php file:
The dilemma with disabling the WP-Cron is, that some features of WordPress will stop running. E.g. – scheduled posts will not work, because it is directly depending on the cron. And also other plugins that are hooked the WP-Cron will stop running.
So a good way to fix this for a high traffic website is to disable the WP-Cron using the code snippet above, but in the same time to set up a cron job to run manually, from your control panel.
This can be easily done by adding a cron job and to set it to be executed at a certain amount of time.
*/15 * * * * php /home/$USER/public_html/wp-cron.php
The cron will run at every 15 minutes and redirect all output to /dev/null.
Running it every 15 minutes means it will run 96 times every day. Which should be fairly enough.
You can even set it to every 30 or 60 minutes. As you prefer.
That’s a wrap!
Setting up the cron to a run every 15 minutes, will first of all lower the resource usage of your account, and maybe even make your site load faster when you have high traffic coming in.