Cron is one of the most useful utility for websites. It is used to schedule operations at a specific time. These scheduled tasks are known as “Cron Jobs”. They're generally used for running heavy tasks in background without impacting website's user experience. Theses tasks can be : checking plugins update, running cache optimization, data import or image bulk optimization.
By default, WordPress does not use a real cron job for running these heavy tasks. Instead, whenever a page is loaded on a WordPress site, WordPress runs the wp-cron.php file. This technique is called "poor man's cron", it has disadvantages :
Edit the wp-config.php and add at the end the following line :
define('DISABLE_WP_CRON', true);
If you do have access in command line to your server, set up a new cron task using the following command line :
crontab -e
This will open a text editor, just paste the following line by replacing the path by your website path :
*/15 * * * * cd /your/path/to/website; php -q wp-cron.php
This command will execute cron operations every 15 minutes (recommanded)
Your hosting provider should provide you a web interface to set up cron jobs (like cPanel or OVH manager). You can declare on this interface your cron job. Schedule it every 15 minutes and run the following command (adapt the path)
cd /your/path/to/website; php -q wp-cron.php
In some case, your hosting provider will apply the default php.ini, which will restrict script duration to max 30 seconds. It's possible to specify a custom php.ini with an increased value of max_execution_time (eg. 300 sec) using the following syntax :
cd /your/path/to/website; php -c /path/to/php.ini -q wp-cron.php