Disable wp-cron.php file in WordPress –

In a previous article we had seen and solve it in case of excessive consumption, the execution of wp-cron in wordpress is another point that we have to take into account.

Hosting Mautic QuickStart -50% with support in Spanish
24 hours and free training

Send up to 1,000,000 emails/year. Mautic support in Spanish 24 hours, 365 days

From the Cpanel of your hosting account you have the option to create a cron task. WordPress also has this functionality built in however WordPress cron is known as virtual con.

In this article we will see how to disable wordpress cron and instead do the task executions via creating a cpanel level cron.

What is a virtual chron?

In order for the WordPress wp-cron to run the website must be loaded, i.e. every time a website loads then WordPress checks if it has any scheduled tasks to perform.

This has two problems, the continuous checking of tasks for each visit and the other is that if your website has few visits the scheduled tasks might not be executed.

What tasks does wp-cron perform?

Among some of the tasks that have this functionality by default are:

  • Check for core updates e
  • Verification of updates of templates and plugins.
  • Pingback shipments.
  • backup processes.
  • Publish articles on specific dates.

Some plugins can also add WordPress cron schedules in addition to the default ones.

Disabling WordPress wp-cron

The first thing we will do is disable the default behavior of WordPress, we will do it with the following code, which must be added to the wp-config.php file of your website.

See also  Invalid Email DIVI Form

define(‘DISABLE_WP_CRON’, true);

The file wp-config.php It is located at the root of your web site.

To locate and edit this file you can use the File Manager of your Cpanel.

Cpanel cron for WordPress tasks

In a previous article we had seen how your hosting account.

From the Cpanel of your hosting account locate the Advanced section and then the cron tasks application.

Schedule the periodicity of the task and set the execution command

The command will be:

/opt/alt/php73/usr/bin/php /home/CPANEL_USER/public_html/wp-cron.php >/dev/null 2>&1

In this command take into account:

  • replaces USER_CPANEL by the name of the cpanel user
  • You can also change php73 to the version of PHP you want, for example to php72 or php74
  • Make sure the path to the wp-cron.php file is correct, the file has to be in the path where you have your WordPress website

The periodicity setting depends on how many times you want the task to run, in our example we have set the cron to every 15 minutes, but you can change that period according to your needs.

In the end we will obtain a new cron task created as shown in the following image

conclusion

Despite having a virtual chron which can work in many cases, if you want to optimize your WordPress website, you have to keep in mind that it is better to have a royal chron configured through your account panel.

Help us improve our content by sharing your opinion

WordPress technical support at and regular speaker at Meetups and WordCamps in America.

Loading Facebook Comments ...
Loading Disqus Comments ...