Skip to content

Instantly share code, notes, and snippets.

@Biont
Created January 10, 2019 09:01
Show Gist options
  • Save Biont/aa9c18115fd3559641e7d314a4480c43 to your computer and use it in GitHub Desktop.
Save Biont/aa9c18115fd3559641e7d314a4480c43 to your computer and use it in GitHub Desktop.
Run WP-CLI command for all sites in the network. Uses 16 threads for parallel execution
#!/usr/bin/env bash
# Usage: multisite.sh plugin list
N=16
i=0
for URL in $(wp site list --field=url); do
((i=i%N)); ((i++==0)) && wait
wp "$@" --url="$URL" &
done
wait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment