How can I (easily) determine which of my wordpress sites are using a given plugin, on a Wordpress Multisite install?

Let's say I have 1,000 wordpress sites on a Wordpress Multisite install. I have 100 plugins.

For each plugin, I want to list all of the sites that are using that plugin.

In the GUI, I can only see how this can be done in about 1 million clicks. Is there a query I can run against the DB (and maybe cleanup with bash/awk/etc) that will automatically

  1. Get all of the plugins installed
  2. For each plugin, list all of the sites that use that plugin (by site-id is fine)

What's a fast way to determine all of the sites that use each of my installed plugins on Wordpress Multisite?

  • 2
    are you comfortable using WP CLI? If so there may be CLI based solutions here that don't require additional PHP/SQL
    – Tom J Nowell
    May 17 at 17:13
  • wp-cli is definitely a valid answer to this question. However, for this server, I can only use software that can be installed from a secure package manager with cryptographically signed manifests (which apt provides but composer, curl, git, brew, etc do not provide) May 18 at 7:30
  • So uploading or downloading wp-cli.phar as the wp cli homepage says in that environment is not an option? Even then nothing prevents you downloading the data and running WP CLI locally, and WP CLI may be a hard requirement as you mentioned 1k+ sites ( and ignoring that files and commits in git are all managed using a cryptographic hash chain )
    – Tom J Nowell
    May 18 at 13:23

1 Answer 1


You can list the sites a plugin has been activated on in the shell using WP CLI:

sites=$(wp site list --field=url)
for url in $sites; do
    if wp plugin is-active "YOURPLUGINNAME" --url="${url}" --network; then
        echo "${url}"

It will print out the URL of each site on its own line that has that plugin activated.

  • Unfortunately, this does not print the site if a plugin is enabled network-wide. May 21 at 10:35
  • @MichaelAltfield that was never mentioned in the original post, my answer tries to list the active plugins on a site as your question requested, and if a plugin is network activated then it is not activated on those sites (but gets loaded anyway). Remember, I'm not trying to give you the answer you want, I'm trying to answer the question you asked. If there are things you expect that aren't said in your question, you have to say them. Listing plugins activated network wide requires a separate and fundamentally different answer ( aka just list all sites )
    – Tom J Nowell
    May 23 at 11:41
  • I've updated my answer by adding --network as instructed by the official WP CLI docs for the plugin is-active command: developer.wordpress.org/cli/commands/plugin/is-active, but I would note this was not a part of the original question
    – Tom J Nowell
    May 23 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.