↑ ↓ select, Enter open, Esc close

Count WordPress plugins by status

Adjust the values, the command updates live
user@server
wp plugin list --format=json --path=/var/www/vhosts/example.com/httpdocs | jq -r 'group_by(.status)[] | "\(.[0].status): \(length)"'

Fetches the plugin list as JSON, groups it by the status field with group_by and prints the status and count for each group. The result looks like active: 14 and inactive: 6. Many inactive plugins are a candidate for cleanup, since deactivated code can still be vulnerable.

Note: The same pattern works with .update instead of .status to count available updates. Run it as the subscription’s system user.

Also searched as

  • how many wordpress plugins are inactive
  • parse wp-cli output with jq
  • count plugins by status wp-cli

Related one-liners

All in Text processing

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.