-
Notifications
You must be signed in to change notification settings - Fork 67
Advanced Queue Setup In CLI mode
Ryan Hungate edited this page Aug 14, 2024
·
9 revisions
This guide details the setup of an advanced queue in CLI mode for the Mailchimp WooCommerce plugin, enhancing performance by running processes in the background, independent of web traffic.
- WP-CLI installed.
- Knowledge of WP-CLI and WordPress installation locations on your server.
- Ability to edit the
functions.php
file, preferably using a child theme or suitable plugin.
-
Edit
functions.php
File: Include the following code:function asdds_disable_default_runner() { if ( class_exists( 'ActionScheduler' ) ) { remove_action( 'action_scheduler_run_queue', array( ActionScheduler::runner(), 'run' ) ); } } add_action( 'init', 'asdds_disable_default_runner', 10 );
Run the queue manually using WP-CLI:
wp --url=https://examplestore.com --path=/full/path/to/install/ action-scheduler run
Stop with control
+ c
.
- Set up a cron job or use a process manager like Monit or Supervisord.
- For cron, edit the crontab:
Add:
crontab -e
Or use a process manager with:* * * * * wp --url=https://examplestore.com --path=/full/path/to/install/ action-scheduler run
/usr/bin/wp --url=http://yourdomain.com --path=/full/path/to/install/ queue listen