WP Cron is a WordPress feature that allows you to schedule tasks to run automatically at specified intervals. It’s essentially a scheduling system that allows you to set up events to run on a recurring basis, such as checking for plugin updates, publishing scheduled posts, and more.
The Issue with WP-Cron
When a visitor accesses your website, WordPress checks to see if any scheduled tasks need to be run. If there are tasks that need to be run, WP Cron will execute them. This means that WP Cron tasks will only run when your website is visited, which can be a problem if your website doesn’t get a lot of traffic. Also, it might slow-down the visitor experience, which can be dramatic!
Manually trigger WP-Cron
This is extremely simple, you simply need to visit your website, or directly visit this URL, which will only call WP Cron:
From the command line of your terminal, you can also run this command:
wget -q -O - https://yoursite.com/wp-cron.php?doing_wp_cron
Automatically trigger WP-Cron regularly
You can call the URL I mentioned above with an online service dedicated to call URLs regularly. To do this, I recommend using EasyCron. It is both cheap (and there is a free version, which might be enough for you) and convenient.
If you are using my Social Engine plugin on a WordPress dedicated for this, for example, you will probably need to use EasyCron to trigger WP-Cron, so that Social Engine can be alive and well, and do its job of scheduling SNS posts. Here is how I use it:
That’s all it needs 🙂
What is this “?doing_wp_cron” added to the URLs
This is added to the URLs to make sure WP Cron is actually ran, and check if there are any pending tasks.
By default, WP Cron is actually ran for every request to WordPress. However, this check can be disabled. This is why ?doing_wp_cron is sometimes added by plugins or WordPress itself as well.
If you are interested, you can disable WP Cron by adding this line to your wp-config:
define('DISABLE_WP_CRON', true) ;
Then you can use the technique I talked about in the previous section to automatically trigger WP Cron through EasyCron, without impacting your visitors.