Have you ever wondered how WordPress allows you to control scheduled posts or which option allows users to send email notifications? For the record, this powerful scheduled system is performed by a cron.php file which resides inside wp-includes folder..This virtual cron is automatically loaded by default when any user visits the site whether any task is scheduled to perform. It is important to know that every time a visitor browse the site, Cron Job is run each time which is why the site takes some time to load. For simple or low-traffic sites, it is admirable but for heavy and high-traffics websites, it slows down the speed performance. In this article, we are going to learn a basic step to enable or disable WordPress Cron Job.
Enable or Disable WordPress Cron Job
– Disable WordPress Default Cron behavior
As we mentioned earlier, WordPress uses the default cron which triggers when it needs to perform a certain task if and only necessary. However, most of the time, WordPress fire CRON unnecessarily each time the site loads although the delay is negligible.
Step 1: Go to your website’s root directory either using CPANEL or FTP server. Open wp-config.php file and find the following code:
Step 2: Now right after the above lines of code, add the following code.
Step 3: Save the file.
Note: Do not forget to backup your wp-config.php file for future security.
This will disallow your CRON job and WordPress will not trigger wp-cron.php each time the site loads.
– Enable WordPress Cron Job
If you wish to enable the WordPress Cron Job again, just edit the above code as below:
Essentially, any visit to the site after the scheduled time will lead to the queued task to run. Further, the WP-Cron is not an exact timer but the “best effort” system. For instance, if you have zero or a few visitors, then it then it doesn’t need to run and do anything for the most of the time.
There are a few plugins which control the execution of the Cron Jobs. If you go thoroughly, some even let you add and delete the schedule events/tasks without having to touch codes. We are not going to elaborate each plugin in details here but we will discuss what they will do in brief. You will need to install and check it by yourself to see what they do.
Some of the Cron Job Plugins
- Advanced Cron Manager – debug & control: The plugin allows you to add, delete, and edit the Cron tasks as per your wish. This plugin also comes with the premium version.
- WP Crontrol: You can control the custom or existing scheduled task with this plugin. WP Control is probably the most popular and the most installed Cron Plugin in WordPress repository.
- WP-Cron Control: This plugin allows you to take control over the execution of cron jobs.
- WPX Cron Manager Light: The prominent feature of this plugin is to display all the registered Cron Jobs in WordPress site. Moreover, it provides the real=time execution of the event or task.
So this is how we can enable or disable WordPress Cron Job for our website. Cron is interesting as well as challenging system. We can deliberately benefit from it if we use the Cron wisely. If you think this article helped you in any way do not forget to hit the share button below. If you have any question, add your comments in the below form. We will try our best to reach out to you.