Thanks to visit codestin.com
Credit goes to github.com

Skip to content

--all --network flag combination incorrectly skips plugins that are active but not network-active #454

@kaspernowak

Description

@kaspernowak

Bug Report

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:

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

  1. Set up a WordPress multisite
  2. Activate some plugins on a single site (not network-wide)
  3. Run wp plugin activate --all --network
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions