Use Linux cron Instead of WP-CRON

WordPress has internal function called WP-CRON, By default every time a page is loaded in admin or on the front-end of your site, WordPress calls WP-CRON. To avoid this, best way optimize the efficiency of your WordPress cron jobs is to disable WP-CRON and set up a Linux cron job. 


  • You need to have a working knowledge of Linux commands before you can use cron jobs effectively.


  • The first step is to prevent WordPress from running WP-CRON automatically, just toss this in your wp-config.php

  • Edit wp-config.php file of your site with your favourite editor. I am using vim editor here

  • Now put the following line just below DB_COLLATE

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

/** Disable the default WordPress Cron */
define('DISABLE_WP_CRON', true);

  •  Save and close the file. Above directives will disable wordpress default WP-CRON

  •  Now we will need to add the actual Linux cron to run the wp-cron.php file manually.

[[email protected]]# crontab -e

*/15 * * * *  wget -O /dev/null -o /dev/null

The above commands tells the server to run wp-cron.php via wget. /dev/null is used to send both stdout and stderr to /dev/null which discards any output and errors.

  • That cron will call wp-cron.php every 15 minutes. You can use a different time here.


Leave a Reply

Your email address will not be published. Required fields are marked *