How To Disable Wp-cron.php

Wp-cron.php is part of WordPress core files. It is used as a virtual cron job for scheduling task. With wp-cron.php, you can automatically publish scheduled posts, checking update for your themes and plugins, sending emails and much more.

Although this is a great feature, yet there are still few downsides using wp-cron.php. This article is part of best useful tips for your WordPress.

Wp-cron.php Downsides

By default, WordPress is set up to call wp-cron.php each time someone visits your WordPress site. This won't be a problem for low traffic websites. But for huge traffic websites, checking scheduled tasks multiple times can lead to massive resource usage. This is wasting and inefficient especially for websites on shared hosting with limited server resource.

Apart from that, there is also another downside of wp-cron.php. As stated above, wp-cron.php will run whenever someone visits your website. Assume you have scheduled an article to be published on certain time, yet your website is not receiving any visitor until a later time. This may lead to publication delay.

How To Disable Wp-cron.php

To overcome these drawbacks, it is always recommended by many WordPress experts to disable wp-cron.php and replace it with a real cron job. To disable wp-cron.php, first, navigate to your WordPress installation folder and locate your wp-config.php file. Next, open your wp-config.php and add the following line before the "/* That's all, stop editing! Happy blogging. */" line:

Once you do that, click save and close your wp-config.php. Now we have disabled our wp-cron.php, next we are going to set up cron job manually for wp-cron.php.

Setup Manual Cron Job

To setup cron job, you need to open your cPanel interface. Next, find and open Cron Jobs tool. It usually located in the Advanced Section in cPanel. Please note that Cron Jobs tool may look vary depending on the control panel used by your hosting company.

How To Disable Wp-cron.php
Cron Jobs tool in cPanel.

For this example, we will set our cron job to run wp-cron.php twice per hour at 0 and 30th minute. First, scroll down and select Twice Per Hour from Common Settings drop-down menu which has some of the most common schedules preset.

Next, add the following command line to your command field. Please don't forget to replace username with your cPanel username.

How To Disable Wp-cron.php
Cron Job command.

Cron Job Plugin

Some of the plugins installed may have created cron events to help your site automate things. You can check, create, remove or modify any cron event by using a plugin. There are few plugins in WordPress directory that can help you manage cron event effortlessly.

WP Crontrol is one of the highest rating cron job plugin. I have been using this plugin for quite some time. It will let you view and control WP-Cron including add, edit, delete or run any cron events. You can also view its arguments, recurrence, callback functions, and when is the next schedule. On top of that, it will show you a warning on admin screen if your cron system stop working.

Aside from that, there are also other plugins such as Advanced Cron Manager and Cronjob Scheduler which offer similar features. Although both plugins had a free version, there is pro version of Advanced Cron Manager as well that might interest you.

Conclusion

In summary, wp-cron is indeed a great feature yet by disabling it will give you more benefits. By manually set up your cron jobs will reduce your server resource usage considerably. It is more efficient to run it at a set interval of time rather than per visit.

  • If you think your friends would find this useful, please share it with them. It will allow us help more people.
  • To get more of our latest update, please subcribe to our newsletter.
  • You can also print this article for reference.
This article has been printed from https://www.jebatonline.com/articles/how-to-disable-wp-cron-php/

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.