Running wp-cron with cronjob
By default wordpress run cronjob everytime user visit your web site. This is bad idea for busy site.
To run wp-cron with cronjob, first edit wp-config.php and add following
1 |
define('DISABLE_WP_CRON', 'true'); |
Now set cronjob.
if you have wp-cli installed, use following cronjob
1 |
*/5 * * * * cd /var/www/html; wp cron event run --due-now > /dev/null 2>&1 |
If you don’t have wp-cli installed, use
1 |
*/5 * * * * cd /var/www/html; php -q wp-cron.php |
Replace /var/www/html to actual folder where your wordpress installation is located.