From e94f60d54cb10fa686c5cb0bac5bbed9da5fec00 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Mar 2026 13:20:48 +0000 Subject: [PATCH 1/3] Initial plan From 5cafad92c7351533de59992bf3535cb104ec9b73 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Mar 2026 13:24:00 +0000 Subject: [PATCH 2/3] Fix wp site list path filter conflict by adding --site-path parameter Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- features/site.feature | 6 ++++++ src/Site_Command.php | 13 +++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/features/site.feature b/features/site.feature index 300eb6f51..a9e098690 100644 --- a/features/site.feature +++ b/features/site.feature @@ -98,6 +98,12 @@ Feature: Manage sites in a multisite installation {SCHEME}://example.com/first/ """ + When I run `wp site list --field=url --site-path=/first/` + Then STDOUT should be: + """ + {SCHEME}://example.com/first/ + """ + Scenario: Filter site list by user Given a WP multisite install diff --git a/src/Site_Command.php b/src/Site_Command.php index 11c0d6ebf..8a429712d 100644 --- a/src/Site_Command.php +++ b/src/Site_Command.php @@ -961,7 +961,9 @@ private function get_network( $network_id ) { * * [--=] * : Filter by one or more fields (see "Available Fields" section). However, - * 'url' isn't an available filter, as it comes from 'home' in wp_options. + * 'url' isn't an available filter, as it comes from 'home' in wp_options, + * and 'path' isn't an available filter, as it conflicts with the global + * `--path` parameter. Use `--site-path` to filter by path instead. * * [--site__in=] * : Only list the sites with these blog_id values (comma-separated). @@ -969,6 +971,9 @@ private function get_network( $network_id ) { * [--site_user=] * : Only list the sites with this user. * + * [--site-path=] + * : Filter by path. Avoids conflict with the global `--path` parameter. + * * [--field=] * : Prints the value of a single field for each site. * @@ -1038,13 +1043,17 @@ public function list_( $args, $assoc_args ) { $where = []; $append = ''; - $site_cols = [ 'blog_id', 'last_updated', 'registered', 'site_id', 'domain', 'path', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id' ]; + $site_cols = [ 'blog_id', 'last_updated', 'registered', 'site_id', 'domain', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id' ]; foreach ( $site_cols as $col ) { if ( isset( $assoc_args[ $col ] ) ) { $where[ $col ] = $assoc_args[ $col ]; } } + if ( isset( $assoc_args['site-path'] ) ) { + $where['path'] = $assoc_args['site-path']; + } + if ( isset( $assoc_args['site__in'] ) ) { $where['blog_id'] = explode( ',', $assoc_args['site__in'] ); $append = 'ORDER BY FIELD( blog_id, ' . implode( ',', array_map( 'intval', $where['blog_id'] ) ) . ' )'; From a2ffb5e930257b228f399571ff2678f9ab274834 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Mar 2026 15:51:14 +0000 Subject: [PATCH 3/3] Restore path in site_cols for WP_CLI_STRICT_ARGS_MODE compatibility Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- src/Site_Command.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Site_Command.php b/src/Site_Command.php index 8a429712d..114bf1446 100644 --- a/src/Site_Command.php +++ b/src/Site_Command.php @@ -961,9 +961,9 @@ private function get_network( $network_id ) { * * [--=] * : Filter by one or more fields (see "Available Fields" section). However, - * 'url' isn't an available filter, as it comes from 'home' in wp_options, - * and 'path' isn't an available filter, as it conflicts with the global - * `--path` parameter. Use `--site-path` to filter by path instead. + * 'url' isn't an available filter, as it comes from 'home' in wp_options. + * Note: '--path' conflicts with the global parameter of the same name; use + * '--site-path' to filter by path instead. * * [--site__in=] * : Only list the sites with these blog_id values (comma-separated). @@ -1043,7 +1043,7 @@ public function list_( $args, $assoc_args ) { $where = []; $append = ''; - $site_cols = [ 'blog_id', 'last_updated', 'registered', 'site_id', 'domain', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id' ]; + $site_cols = [ 'blog_id', 'last_updated', 'registered', 'site_id', 'domain', 'path', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id' ]; foreach ( $site_cols as $col ) { if ( isset( $assoc_args[ $col ] ) ) { $where[ $col ] = $assoc_args[ $col ];