Fix --network-wide flag in WP-CLI index command #2771
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the Change
As stated in #2766, ElasticPress 4.x introduced a change in the
index
WP-CLI command that it would always index all sites, even when the--network-wide
flag is not passed. This PR changes that back to the 3.x behavior:In order to index all sites, the user needs to run
wp elasticpres index ... --network-wide
, otherwise only the main site will be indexed.In addition to that, this PR also fixes all WP-CLI commands that rely on get_index_names() method, using indices names for all sites only when it is network activated. Commands affected are:
Closes #2766
Changelog Entry
index
command without the--network-wide
only syncs the main site.Credits
Props @felipeelia @colegeissinger