Home » cPanel » How to disable the WordPress cron and set it as a real Cron Job within cPanel?

How to disable the WordPress cron and set it as a real Cron Job within cPanel?

In WordPress, wp-cron.php is acting as a task scheduler. It takes care of things like checking for updates and publishing scheduled posts.

It runs on every single page load. If your site has not been visited in a while, it will have a lot of missed tasks to catch up which can increase loading time with additional resource usage issues.

If you are using any caching plugin or CloudFlare, the scheduled posts may even never get published.

You can fix this issue easily in two steps given below:

Step 1) Disable wp-cron at the WordPress wp-config.php

Step 2) Setup wp-cron as a real Cron job under cPanel

This trick will help to improve the load time of your website and make sure that wp-cron is running maintenance tasks whether someone has visited your website or not.

So, let’s see the exact steps you have to follow here:

Step 1) 

1) Login to your cPanel and access File Manager.

Now go to the Document root folder of the domain.

2) Right-click on wp-config.php file and select Code Edit:

This will open the file wp-config.php to edit the code. Here you have to enter following code after <?php tag:

define('DISABLE_WP_CRON', true);

then Save the file to disable the wp-cron within WordPress:

That’s it! You have completed Step 1.

Step 2)

For Step2 check our article to setup cron jobs in cPanel.

The thing you need to take care of is to use the correct command in the command section while adding cron.

/usr/bin/php /home/USERNAME/public_html/wp-cron.php >/dev/null 2>&1

where USERNAME is your cPanel Username and public_html is your website’s Document Root folder.

By default cron jobs sends an email to the user email account after execution. If you don’t want to receive an email for the executed cron job add the following command at the end of the cron job line.

>/dev/null 2>&1

Leave a Reply