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.
Scroll down to Files
section and click on "File Manager"
Now you need to navigate to public_html > wp-config.php file
Right click on wp-config file
and click on edit
as shown in the screenshot.
In Text Editor pop-up window press Edit
button to edit this wp-config file.
Now wp-config file is opened in cPanel File Manager Code Editor.
Scroll down to line number 37 in the code. The line will look like following:
Now you need to enter the following code just below the above code in wp-config 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:
Login to cPanel.
Scroll down to Advance
section and click on Cron Jobs
Scroll down to Add a New Cron Job
section and enter the following:
Select Twice Per Day (0 0, 12 ***)
from the drop down menu.
Now the remaining fields are filled accordingly automatically.
In this field you need to enter- cd /home/username/public_html; php -q wp-cron.php
Replace username with cPanel User Name.
Click on Add New Cron Job