Guide to to Disable the wp-cron.php in WordPress
A Cron Job is basically a scheduled task and the wp-cron.php file is a way to check that list of task and run them if their time has passed. But this file can not self-execute so WordPress has to access it every single time someone visits your site to see if there is anything on the list that needs to be done. That can be demanding, especially when you start to get traffic across multiple websites on one hosting account. Things like scheduled database backups, checking for plugin updates, clearing the cache, publishing a scheduled post and more. If you have a lot of these running rampant every 15 minutes or hour they start to stack on top of each other.
So we want to stop this insanity that runs every time someone visits our page. So here is how we do it.
- FTP, SFTP or File Manager write access to WordPress Site.
- cPanel Login Credentials.
- Login to your cPanel account where your WordPress is Hosted
- Open File Manager
- Locate file wp-config.php inside home directory of your WordPress site and edit.
- Locate define(‘DB_COLLATE’, ”); line inside wp-config.php file and just below that line write the following flag.
/** Disable WordPress Cron
- Save and Exit.
- Goto Homepage of cPanel and Locate CronJobs feature and open it.
- Go to Add a New Cron Job, select Common Settings and select option Once Per Hour
- At the Command Field type the below command to run wp-cron.php once per hour
cd /home/your_username/public_html; php -q wp-cron.php
Note – Here your_username should be replaced with your cPanel Username and this command will run automatically after one hour cycle.
- Tap on button Add New Cron Job
- It will show message Cron Job successfully Added