From 674819ca070e1606d756fc89137f54e358ba86e5 Mon Sep 17 00:00:00 2001 From: Aleksei Tikhomirov Date: Sat, 25 Jul 2026 00:05:23 +0300 Subject: [PATCH] feat(cli): add --daemon flag to wp queue work --- src/CLI/QueueCommand.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/CLI/QueueCommand.php b/src/CLI/QueueCommand.php index 244f650..eac4d1c 100644 --- a/src/CLI/QueueCommand.php +++ b/src/CLI/QueueCommand.php @@ -106,11 +106,15 @@ public function status(array $args, array $assocArgs): void * default: 256 * --- * + * [--daemon] + * : Run the worker continuously as a daemon. + * * ## EXAMPLES * * wp queue work * wp queue work emails --limit=50 * wp queue work imports --memory=512 + * wp queue work --daemon --memory=256 * * @when after_wp_load */ @@ -128,6 +132,13 @@ public function work(array $args, array $assocArgs): void $worker = WPQueue::worker(); $worker->setMemoryLimit($memory); + if (isset($assocArgs['daemon'])) { + WP_CLI::log("Starting daemon worker for queue: {$queue}"); + $worker->daemon($queue); + + return; + } + $processed = 0; while ($processed < $limit) {