Skip to content

Instantly share code, notes, and snippets.

@cyrillbolliger
Last active February 19, 2020 23:13
Show Gist options
  • Save cyrillbolliger/a08e0f18e029f7375e9c3c00ff0698aa to your computer and use it in GitHub Desktop.
Save cyrillbolliger/a08e0f18e029f7375e9c3c00ff0698aa to your computer and use it in GitHub Desktop.
WP-CLI Multisite apply command to every subsite

WP-CLI Multisite apply command to every subsite

You need to apply a wp-cli command to every blog of a WordPress multisite installation?

List all pages and pipe the URLs using xargs to your wp command:

wp site list --field=url | xargs -n1 -I % wp --url=% YOUR_WP_COMMAND_HERE

Examples

  • Deativate plugin on every subsite:

    wp site list --field=url | xargs -n1 -I % wp --url=% plugin deactivate PLUGIN_SLUG

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment