Skip to main content

wp plugin get

Overview

Get detailed, low-level metadata about a specific installed plugin — file header data, version, status, author, and more. More detailed than wp plugin status, and ideal for scripting and automated audits.

What It Does

wp plugin get reads the plugin's PHP file header to extract all registered metadata fields, then combines that with the current activation status and update information. It returns structured data, making it perfect for scripting.

Syntax

wp plugin get <plugin> [--field=<field>] [--fields=<fields>] [--format=<format>]

Arguments & Options

Argument / FlagDescription
PLUGINPlugin slug to inspect
--field=FIELDReturn only a single field value
--fields=FIELDSComma-separated list of fields to show
--format=FORMATOutput: table, json, csv, yaml

Available Fields

FieldDescription
namePlugin slug (folder/file name)
titlePlugin display name
authorPlugin author
versionInstalled version
statusactive, inactive, must-use, dropin
descriptionPlugin description (from header)
author_uriAuthor website URL
plugin_uriPlugin homepage URL
networkRequires network activation flag
requires_wpMinimum WordPress version required
requires_phpMinimum PHP version required
updateavailable or none
update_versionAvailable update version number
auto_updateon or off

Basic Usage

Get all plugin details

wp plugin get woocommerce

Output:

+--------------+---------------------------------------------+
| Field | Value |
+--------------+---------------------------------------------+
| name | woocommerce |
| title | WooCommerce |
| author | Automattic |
| version | 9.0.1 |
| status | active |
| update | available |
| update_version | 9.1.0 |
| requires_wp | 6.4 |
| requires_php | 7.4 |
| auto_update | off |
+--------------+---------------------------------------------+

Get a specific field

wp plugin get woocommerce --field=version

Output:

9.0.1

JSON output for scripting

wp plugin get woocommerce --format=json

Get only specific fields

wp plugin get woocommerce --fields=name,version,status,update_version

Real-World Scenarios

Scenario 1: Capture plugin version in a deployment script

WC_VERSION=$(wp plugin get woocommerce --field=version)
echo "WooCommerce installed: ${WC_VERSION}"

Scenario 2: Enforce minimum PHP version requirement

REQUIRED_PHP=$(wp plugin get woocommerce --field=requires_php)
CURRENT_PHP=$(php -r "echo PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;")

echo "Plugin requires PHP ${REQUIRED_PHP}; server runs PHP ${CURRENT_PHP}"

Scenario 3: Generate a plugin inventory report

PLUGINS=$(wp plugin list --field=name)
echo "name,version,status,author" > plugin-inventory.csv

for plugin in $PLUGINS; do
wp plugin get "${plugin}" --fields=name,version,status,author --format=csv 2>/dev/null | tail -1 >> plugin-inventory.csv
done

cat plugin-inventory.csv

Scenario 4: Check if requires_wp is compatible with current WordPress

WP_VERSION=$(wp core version)
REQUIRED_WP=$(wp plugin get woocommerce --field=requires_wp)
echo "WordPress: ${WP_VERSION} | WooCommerce requires: ${REQUIRED_WP}"

wp plugin get vs wp plugin status

Featurewp plugin getwp plugin status
Raw file header data
requires_wp / requires_php fields
plugin_uri / author_uri
Scriptable JSON outputPartial
Summary view of all plugins
Better for audit scripting

Best Practices

  1. Use --field=version in scripts instead of parsing full output.
  2. Use --format=json for machine-readable output in automation pipelines.
  3. Use --fields to limit output to only what you need — faster and cleaner.
  4. Loop over wp plugin list --field=name to build per-plugin reports with wp plugin get.

Troubleshooting

ProblemCauseFix
Error: The plugin could not be foundWrong slugCheck with wp plugin list --field=name
Empty field valuesPlugin header missing that fieldNot all plugins declare all header fields
requires_php not shownOld plugin formatCheck plugin header file manually

Quick Reference

wp plugin get woocommerce                        # Full details
wp plugin get woocommerce --field=version # Version only
wp plugin get woocommerce --format=json # JSON for scripting
wp plugin get woocommerce --fields=name,version,status,update_version

Next Steps