1

I have a bunch of standalone WordPress sites, and WordPress Multisite Network of Sites on my server. There are times where there are too many sites all running cron jobs too soon in proximity. I am looking to better control when cron jobs are triggered on each WordPress website.

Is it possible to disable WordPress cron jobs from being triggered anywhere, and limit it exclusively to ./wp-cron.php? If so, how?

I would like to setup cron jobs via Linux to target each domain's ./wp-cron.php file at the times I specify. In theory, this should alleviate most of the server bogging I've been experiencing.

Is this an ideal solution to better control the cron jobs on each of my WordPress sites?

Is there something I should be doing within WordPress itself, which could better control the cron jobs, so that I don't get too many sites all running their cron jobs at the same time?

Trying to conserve server resources, cron jobs are the culprit here.

  • Sidenote: "Cron" is a software utility, so you can't "setup cron jobs via Linux". It also isn't exclusive to Linux or even UNIX systems. – kaiser May 30 '14 at 16:54
3

To disable WordPress Cron Jobs, place this in wp-config.php:

define('DISABLE_WP_CRON', true);

To schedule a cron job in Linux with cPanel for example...

This is the command you might run:

wget -q -O - http://www.your-domain.org/wp-cron.php?doing_wp_cron >/dev/null 2>&1

The end of the above command just suppresses any output.

Just pick the interval of your choice for setting up your cron job in cPanel or SSH or how ever you are setting up your cron job and use the command above.

The above command tells the Linux server to run wp-cron via wget, which will trigger the wp-cron.php script to do it's job on your schedule instead of on each page view. This will lessen the amount of processes on the server.

I have immediately noticed a difference in my server load after making this change.

  • to make your answer more complete - please provide an IIS variant of this – Brandt Solovij Jul 7 '14 at 21:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.