WP-Cron executes specific tasks for WordPress sites. The name Cron comes from the Unix/Linux service Cron, typically used to schedule commands or scripts.
Why would someone want to disable WordPress cron?
This post shows you especifically how to disable the internal WordPress cron
Table of Contents
- Understanding WordPress Cron Job
- WP-Cron problems With Low Traffic Sites
- Disabling WP-Cron
- Calling WP-Cron Externally
Understanding WordPress Cron Job
WP-Cron, by default, only runs when someone visits your site. Whenever someone visits your site, WP-Cron checks if there are any scheduled tasks to be run. If it finds that a task’s scheduled time has been met, it will go ahead and run that task.
WP-Cron problems With Low Traffic Sites
Low traffic WordPress sites may experience skipped tasks when this feature is triggered by visitors. If people aren’t visiting your site, WP-Cron can’t execute. This doesn’t necessarily mean your page will be slow from previous jobs when someone eventually does visit your site. Tasks are run in the background, this is perfect, but depending on the task and its database aggressivity, the user browsing your site can have a bad experience.
Disabling WP-Cron
If you’re a Wetopi client, we already have done this for you. At wetopi we run the wp-cron from an external cron service every 20 seconds.
Otherwise, first thing you have to do is to disable WP-Cron’s internal processing:
Add the following line to your wp-config.php
file:
define('DISABLE_WP_CRON', true);
By disabling WP-Cron, you have turned off the automatic checking and calling of the wp-cron.php
script. You will now have to call that URL using an external service.
Calling WP-Cron Externally
Once your internal WordPress cron is disabled you have to execute the wp-cron.php
script by calling https://yourdomain.com/wp-cron.php
You can use your cpanel or plesk panel to add a cron job task.
If you don’t have a cron scheduler in your panel, You can set up an account in one of those free cron services:
Creating a single job that calls your site’s https://yourdomain.com/wp-cron.php
script every 5 minutes is all you should need. WP-Cron will take care of the rest.
Don’t you have an account on Wetopi?
Free full performance servers for your development and test.
No credit card required.