2 minute read

How to disable the wp-cron.php in WordPress from your cPanel account

WordPress uses the wp-cron.php file for running many features in WordPress that required scheduled task to be completed automatically. The examples of these tasks basically include: posting a scheduled post in WordPress, checking for the updates of the plugins and themes, automatic trackbacks and generating automatic notifications. The wp-cron works as a virtual cron, which used to run after regular time interval.

But wp-cron can cause high resource usage in WordPress many times. And you can replace it with actual cron to fix this.

For that you need to do the following:
1) Disable wp-cron in WordPress
2) Setup manual cron for disabled wp-cron

Disable wp-cron in WordPress

You can easily disable the execution of default wp-cron.php file in WordPress by following the below steps:

1) Login to your cPanel.

2) Scroll down to Files section and click on “File Manager” icon.
File Manager in cpanel

3) Now you need to navigate to public_html > wp-config.php file.

4) Right click on wp-config file and click on edit as shown in the screenshot.

Edit wp-config.php file in cpanel

5) In Text Editor pop-up window press Edit button to edit this wp-config file.

Press Edit button in Text Editor
Now wp-config file is opened in cPanel File Manager Code Editor.

6) Scroll down to line number 37 in the code. The line will look like following:

define(‘DB_COLLATE’, ”);

7) Now you need to enter the following code just below the above code in wp-config file:

define(‘DISABLE_WP_CRON’, ‘true’);

Disable wp-cron.php file

8) Click Save button.

Save wp-config.php file

Now automatic execution wp-cron.php has been disabled from your WordPress.

Setup manual cron for disabled wp-cron

As we have disable the execution of wp-cron.php file so we need to manually setup of Cron job. You can setup the cron job manually by follow the following steps:

1) Login to cPanel.
2) Scroll down to Advance section and click on Cron Jobs icon.

 Cron Jobs in cPanel

3) Scroll down to Add a New Cron Job section and enter the following:

Common Settings: Select Twice Per Day (0 0, 12 ***) from the drop down menu.
Now the remaining fields are filled accordingly automatically.
Command: In this field you need to enter- cd /home/username/public_html; php -q wp-cron.php
Note: Replace username with cPanel User Name.

Add a new cron job in cpanel

4) Click on Add New Cron Job button

Add new cron job

Table of Contents

    Related Articles