Adds columns to the Network Admin Plugins, Themes and Sites screens showing which sites use each plugin and theme, plus two filters on Plugins and Themes so you can safely clean up: “Unused” (nothing on the network uses it) and “Held by inactive sites” (used only by archived, spam or deleted sites, so not unused, but worth reviewing before you remove anything).
Inspired by the original Network Plugin Auditor by Kristen Semel.
Usage is stored in a single network option that is rebuilt in short steps and then updated whenever a site changes plugins or themes. Measured in a test network: rebuilding the index for about 900 sites took under 3 seconds in a fresh request (roughly 3 milliseconds per site), the index for 1,000 sites took about 230 KB, and it stayed correct after hundreds of plugin, theme, archive, spam and delete changes. A network of 10,000 sites is expected to need roughly 2 MB and about half a minute for the first build, but has not been tested at that size. Each change rewrites the whole index, so networks where many sites change plugins at the same moment may notice extra database writes.
Query the audit index from the command line. Build it first with wp plugroster rebuild.
wp plugroster plugin akismet lists the sites where a plugin is active (a plugin file or directory name; network-active plugins get a warning).wp plugroster theme twentytwentyfive lists the sites using a theme.wp plugroster unused lists the plugins and themes nothing uses, with the same rules as the Unused tabs (add --type=themes or --type=plugins to narrow it).wp plugroster missing lists plugins and themes that sites still use but that are no longer installed, with the sites affected.wp plugroster rebuild scans every site and rebuilds the index.wp plugroster status shows when the index was built and whether it is current.
plugin and theme accept --format=table|csv|json|yaml|ids|count and --fields=blog_id,url,name,status; unused accepts --format=table|csv|json|yaml|count. unused refuses to answer from an index that is missing or may be out of date.