diff --git a/includes/classes/Command.php b/includes/classes/Command.php index e8e2fe64bd..0d014a5a4f 100644 --- a/includes/classes/Command.php +++ b/includes/classes/Command.php @@ -248,7 +248,7 @@ private function put_mapping_helper( $args, $assoc_args ) { $non_global_indexable_objects = Indexables::factory()->get_all( false ); $global_indexable_objects = Indexables::factory()->get_all( true ); - if ( isset( $assoc_args['network-wide'] ) && is_multisite() ) { + if ( isset( $assoc_args['network-wide'] ) && defined( 'EP_IS_NETWORK' ) && EP_IS_NETWORK ) { if ( ! is_numeric( $assoc_args['network-wide'] ) ) { $assoc_args['network-wide'] = 0; } diff --git a/tests/cypress/integration/wp-cli.spec.js b/tests/cypress/integration/wp-cli.spec.js index 4a45c13119..62d9f6ae8b 100644 --- a/tests/cypress/integration/wp-cli.spec.js +++ b/tests/cypress/integration/wp-cli.spec.js @@ -151,6 +151,13 @@ describe('WP-CLI Commands', () => { .its('stdout') .should('contain', 'Adding post mapping') .should('contain', 'Mapping sent'); + + cy.activatePlugin('elasticpress', 'wpCli', 'network'); + + cy.wpCli('wp elasticpress put-mapping --network-wide') + .its('stdout') + .should('contain', 'Adding post mapping for site') + .should('contain', 'Mapping sent'); }); it('Can recreate the alias index which points to every index in the network if user runs wp elasticpress recreate-network-alias command', () => {});