Replacing WordPress WP Cron with Linux cronjob (URL and wp-cli Method)

Originally published at: https://managingwp.io/2021/08/27/replacing-wordpress-wp-cron-with-manual-cron-url-and-php-method/

Content Error or Suggest an EditNotice a grammatical error or technical inaccuracy? Let us know; we will give you credit! What is the WP-Cron The WordPress WP-Cron is used to run scheduled tasks within WordPress core, as well as plugins such as WooCommerce. The WordPress WP-Cron will run on each page visit by a visitor,…

I just had a thought about this - what is the appropriate periodicity of the cron job? You’ve set it to 5 minutes, but should it be more frequent? It seems possible that some plugins are expecting a cron job to trigger on the next page load, be it 5 seconds later of 5 days later. If it isn’t triggered before that, perhaps there could be an issue.

Yet, then we’re ultimately back at the same issue that we are trying to solve - running the cron jobs on every page request and taxing the server.

I guess 5 minutes is a decent enough starting point and adjustments could be made if problems are noticed. Yet, most clients would never notice any problems, let alone know where to look - even with good logging/monitoring…

Indeed, also with chron-shim.sh you can run it every minute and it will check to see if it’s still running and not run again until the previous run is completed. If it’s still running for 5 minutes it will kill the previous run.