Closed baizmandesign closed 1 year ago
Thanks for the suggestion, @baizmandesign !
How would you see wp core is-multisite
as different from wp core is-installed --network
?
@danielbachhuber Oh my, it's not different! I'm embarrassed to say I didn't see that flag in the commands documentation (and I consult the docs almost daily, both on the web and via wp help
). Feel free to reject this proposal and close this issue. Sorry to have wasted your time!
@baizmandesign No worries! Appreciate you stopping by, and glad we already had a solution for you 😊
I'd like to propose adding a new command that tests whether a WP instance is a multisite installation:
It would work similarly to
wp core is-installed
and return 0 if the instance is a network and 1 if it isn't a network. (I don't think we need to create an inverse command to test whether a site is a non-networked singleton... that's the more common occurrence.)Why is this command useful? When activating and deactivating plugins, an additional
--network
parameter can be passed to them. I have scripts that automatically activate and deactivate plugins across several installations, and of those installations some are singletons and some are networks. This would be useful to determine whether I needed to add the--network
flag. (There must be other use cases where it's beneficial for scripts and humans to quickly test whether a site is a network.)One reason not to consider this command is because, thanks to WP CLI, it's already trivial to determine whether a site is part of a network by obtaining the return value of the command below:
But part of me feels as if a command like this should be native to WP CLI and would be of a piece with commands like
wp core is-installed
,wp plugin is-installed
,wp theme is-active
, etc.