Press enter to see results or esc to cancel.

WP-Cron: Replace it with real Cron Job for Faster Website

WP-Cron is a WordPress feature, which simulates the server-side cron jobs. The downside of the default settings is that WP-Cron (wp-cron.php) runs with every single request to your WordPress site. You can simply disable this behaviour in favour of faster and more optimised cron jobs triggered every X minutes (each 5 to 10 minutes for wp-cron is ideal setting).

Disable default wp-cron trigger with adding the following line in your wp-config.php:

define('DISABLE_WP_CRON', true);

Enable cron job (to run WP-Cron) on your server

You can enable cron job on your server, with the following command, while logged in Command Line Interface via SSH:

crontab -e

Alternatively, you can add cron job via cPanel (when your WP is hosted on shared hosting) or via other control panel (such as VestaCP or RunCloud) when your WP is hosted on your own self-managed VPS.

When editing crontab, add the following line and save the file (and replace domain.com with your own domain name:

*/10 * * * * wget -q -O /dev/null https://www.mydomain.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1

If you are adding your cron job via control panel (cPanel or any of the mentioned above) choose cron job to be run “every 5 minutes” or “every 10 minutes” and for the cron job command, insert the following line:

wget -q -O /dev/null https://www.mydomain.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1

If you followed all steps in this tutorial, your WordPress site is successfully configured to execute WP-Cron every 5 or 10 minutes, without triggering it on every single request. We wish you to get great impact on faster page loading because of this setup! 🙂