How Do I Disable WP-Cron In WordPress

How Do I Disable WP-Cron In WordPress?

Share:

Improving your WordPress website’s performance should be the website administrator’s top priority. One of the best ways is disabling WP-cron. What is it, why should we disable it, and how to disable it are the subject of this article.  

What is wp-cron?

We have to schedule many jobs after a fixed period in daily life. They are called cron jobs. WordPress is no exception. Similarly, you have to do things on your WordPress website after a fixed interval of time. Some examples of WordPress cron jobs are post-scheduling, update checking, or taking backups. 

WP-cron handles such processes in WordPress typically. However, this is not always useful. On the contrary, it turns out to be harmful in some cases. Let us explore this in detail. 

How Does WP-cron Affect Performance? 

The WordPress built-in cron handle raises some issues. However, remember that this is WP-Cron, not a real cron job. It just replicates the functions of system cron. Therefore, it is not equivalent to system cron. 

Now, WP-cron is not running all the time. It runs every time the page is loaded. The file wp-cron.php works at every page load. It is not very good when the website receives high traffic.

Sometimes a website does not have enough PHP workers. Here is what may happen in such a case. A request will come, and WordPress will spawn the cron, but the cron will keep sitting there waiting for workers.

The opposite scenario would also not be good. The website has little traffic, the page does not reload at the time, and it misses the cron job. You may have to publish four posts monthly, and only one visitor comes at a time. 

So, it would be best to disable the WP-cron and use system cron instead. 

How To Disable WP-cron?

The first thing you need to do is to access the wp-config file. For that, you must log into cPanel. Now, hit the “File Manager” icon. Then, navigate to the public_html folder. Now, locate and open wp-config.file. After opening, add the following lines:

define(‘DISABLE_WP_CRON’, true);

Add this at the bottom of the file around line 68. Then save the file. Now, you have successfully disabled WP-cron. You may move on from here, but it is okay now to create cron jobs to ensure that specific tasks will be carried out by themselves. 

How to Create a Cron Job in cPanel

You have to log in to cPanel to make your own cron job. Or maybe you are already there because you have just accessed the wp-config file. Navigate down and find the advanced section. Open it.

You will see the ‘add new cron job’ section. Now add the settings you want under the Common Settings area. Several predefined sections will be there for you, and you can choose any of them. For example, there may be options like twice daily or once weekly. Select the one you find the best. 

Then, you add the following code to the command line: 

wget -q -O – https://domain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1

Then, you replace the portion of https://domain.com with your domain. Depending on your hosting configuration, there could be a little difference in the command. 

Hereafter, you click on the “Add a new cron job.”

Congratulations! You have successfully created your own cron job with the help of cPanel.  

Easy Cron

Sometimes, you do not want to create your own cron jobs in cPanel. It is also likely that your web host refuses to provide you access. Here is another option you have. You may use a solid third-party option, one of which is EasyCron. It is the best way out when the above procedure is not your priority. 

It offers everything you need to perform all cron functions. Also,  you can do all of this much more easily.

Final Thoughts

Disabling cron in WordPress is not that simple a decision. There is so much to think about. The site will run smoothly, but there are some functions that you have to perform in every case. That is why it is best to make your own cron jobs in cPanel. 

The Email Shop makes this process a piece of cake. Buy our cPanel hosting or WordPress hosting to reap the benefits. Then, you have to open the crontab and attach the desired file with the details of the cron jobs.

WordPress plugins are great, but you cannot handle everything with a plugin. Sometimes you need knowledge of website files and how they work. You should know where to access them and how to configure them. We hope this tutorial has been comprehensive enough to teach you how to disable WP-cron.

For Discount and Offers, Visit our Official Twitter Page