Wednesday 23 August 2017

Scheduling WordPress Tasks and WP-CLI Commands to Run from System Cron – Shawn Hooper – WordPress Developer & Speaker


WordPress comes with a built-in task scheduler called WP-Cron. This is the part of core that regularly checks to see if WordPress itself needs updating, or if any of your plugins and themes have updates available. Named after the Unix Cron service that runs various system tasks at specified intervals, WordPress’ implementation isn’t a true cron service though – there is no guarantee that your task will run exactly when you have it scheduled to. This is because WP-Cron is triggered when a page on your site is viewed. The upside to this is that you don’t have to fiddle with cron jobs to get WordPress’ tasks running, it’s just part of the web application. The downside though: if your site has occasional traffic, tasks will only be run when the next page visit happens.
If you want WordPress tasks to run reliably, you can disable the built-in trigger to run cron jobs, and instead configure your server’s system cron service to trigger the WordPress scheduler.
Prerequisites
To implement the solutions shown below, you will need to be able to modify your system cron file. Your ability to do so will depend on your web host’s setup. For example,
Source: https://managewp.org/articles/15944/scheduling-wordpress-tasks-and-wp-cli-commands-to-run-from-system-cron-shawn-hooper-wordpress-developer-speaker




source https://williechiu40.wordpress.com/2017/08/23/scheduling-wordpress-tasks-and-wp-cli-commands-to-run-from-system-cron-shawn-hooper-wordpress-developer-speaker/

No comments:

Post a Comment