Disabling the wp-cron.php in WordPress
Recently I came across a need to disable all WordPress Cron Jobs as some of the
woocommerce jobs and Disqus sync cron jobs were using lots of CPU.
In this tutorial we will go over simple steps by which you could disable all WordPress Cron jobs. This tutorial will also help if you have any one of below questions:
- Can I disable Cron job?
- High server load and dsq_sync_forum problem
- How to Replace WordPress Cron with a Real Cron Job?
- Disable WordPress Cron Jobs
- Properly Setting Up WordPress Cron Jobs
- How to Disable wp-cron Running in the Background?
Add below line to wp-config.php file. Make sure you backup existing file just incase required.
This will disable WordPress Cron job functionality on your site. We want to do this only if you don’t want some plugin or themes to create so many Cron jobs.
Take a look at an issue on Github which I’ve created for Yoast SEO plugin. I believe, it’s fix now. Now as we have disabled all cron jobs how to run some required cron jobs like:
wp_version_check wp_update_plugins wp_update_themes wp_scheduled_delete .... ....
Another way to disable wp-cron.php execution is to use
.htaccess file. Take a look at this tutorial.
- Go to
- Search for Cron Jobs under Advanced Section
Setup Cron job with below parameter. Make sure you update
username with your
cd /home/username/public_html; php -q wp-cron.php
If you have installed WordPress under some directory like
/crunchify then please add /crunchify in above command. Your new command should look like below:
cd /home/username/public_html/crunchify; php -q wp-cron.php
And you are all set. You should see Cron job setup successfully.
Above cron job which we setup in cPanel will run every 12 hours and execute all required cron jobs.