CRON jobs in the IT world describe the tasks scheduled at regular intervals. Following a specific timeline from the server that can be customized, WordPress can be setup using this system as well.
The default setup of WordPress can be a bit obtrusive as the schedule can be verified every time a page is loaded which means every time a user is navigating on your site.
If not the case, a wrong setup or the inappropriate use of the caching system can often cause side effects that prevent triggering the schedule at the right time.
I recommend skipping the default configuration in favor of the server CRON jobs of your web hosting.
Step 1: Disable the default Wordpress CRON
Editer le fichier wp-config.php et ajouter la ligne suivante :
Maintenant que le CRON est désactivé, toutes les tâches dans la file d'attente du système de gestion ne seront pas traîtées.
Step 2: Trigger Wordpress CRON from the web server CRON
Most of web hosting companies nowadays offer server task management from an admin panel with more or less options for the setup. We won't be able to cover every case but let's review together the basics.
Common Case: Shared Hosting like OVH
For any shared hosting platforms, you need to know the path to PHP. Mostof the time the required command is available from your host FAQ. It will be something looking like this :
Path to your root folder
The second information you need is the path to the root location of your website. Depending if you are using your primary domain or a subdomain, there might be a slight difference but it often looks like the home folder on a Linux system :
Add the WordPress tasks to the CRON
Basically what you need to do is to go to the Task Manager - or a similar menu like CRON Tasks or CRON Jobs should be available in your admin panel like Cpanel - and trigger via a task the file called wp-cron.php - a file included with every Wordpress setup - from the PHP command.
The task will look like :
You will need to define the period. Running the task Once per hour is enough. If you are using features like future publishing, custom caching, etc... you can reduce it to 30 or 15 minutes depending on your use.
With shared hosting plans - resources are shared between the clients - limits are often set by the web hosting company in charge to avoid the server to being stuck with too many tasks once at a time.
With specific cases like an e-commerce site, you might want to consider reducing to a fastest 5-minute pace but nobody should use less than that to avoid troubles with the queue.