-
Couldn't load subscription status.
- Fork 87
Description
Bug Report
- Yes, I reviewed the contribution guidelines.
- Yes, more specifically, I reviewed the guidelines on how to write clear bug reports.
Describe the current, buggy behavior
When running wp plugin activate --all --network, the command skips any plugin that is already active (even if only on a single site) due to this check in the code:
extension-command/src/Plugin_Command.php
Lines 367 to 369 in c125c84
| if ( $all && in_array( $status, [ 'active', 'active-network' ], true ) ) { | |
| continue; | |
| } |
This results in the command not network-activating any plugins that are already active on a single site, even though they're not network-active.
Describe how other contributors can replicate this bug
- Set up a WordPress multisite
- Activate some plugins on a single site (not network-wide)
- Run wp plugin activate
--all --network - Observe that already-active plugins are skipped and not network-activated
Describe what you would expect as the correct outcome
The --all --network combination should only skip plugins that are already network-active. Plugins that are active on a single site should be deactivated and then network-activated.
Let us know what environment you are running this on
wp-env:
OS: Linux 6.10.14-linuxkit #1 SMP Thu Mar 20 16:32:56 UTC 2025 aarch64
Shell:
PHP binary: /usr/local/bin/php
PHP version: 8.2.28
php.ini used: /usr/local/etc/php/php.ini
MySQL binary: /usr/bin/mariadb
MySQL version: mariadb from 11.4.5-MariaDB, client 15.2 for Linux (aarch64) using readline 5.1
SQL modes:
WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir: phar://wp-cli.phar/vendor
WP_CLI phar path: phar:///usr/local/bin/wp
WP-CLI packages dir:
WP-CLI cache dir: /home/kaspernowak/.wp-cli/cache
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.12.0
✔ Ran `wp cli info` in 'cli'. (in 1s 96ms)
Provide a possible solution
Modify the check to only skip plugins that are already network-active:
if ( $all && 'active-network' === $status ) {
continue;
}This would allow the command to network-activate plugins that are only active on a single site.