0

I have recently decided it would be best if i disable the built in wordpress cron function and move to the system cron which will activate the wordpress cron every 15 minutes.

I am wondering which way is best and what the differences are performance wise etc?

The two ways I have seen this done are:

curl http://example.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1

and

cd /var/www/example.com/htdocs; php /var/www/example.com/htdocs/wp-cron.php?doing_wp_cron > /dev/null 2>&1

Which way is better, and what are the benefits of a certain way?
Any advice would be great and appreciated!

  • Direct PHP should be a little bit nicer for server, but it won’t be a big difference, I guess. Do whatever is easier for you. – Krzysiek Dróżdż Dec 24 '18 at 17:28
0

The official wordpress documentation https://developer.wordpress.org/plugins/cron/hooking-into-the-system-task-scheduler/ suggests doing it via a web request rather as per your first example rather than php CLI as per your second example. Their example uses wget, but your curl request would work just as well. I believe they are using the web request replicates the standard http requests that would otherwise trigger wp-cron.php.

| improve this answer | |

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.