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 / Flag | Description |
|---|---|
PLUGIN | Plugin slug to inspect |
--field=FIELD | Return only a single field value |
--fields=FIELDS | Comma-separated list of fields to show |
--format=FORMAT | Output: table, json, csv, yaml |
Available Fields
| Field | Description |
|---|---|
name | Plugin slug (folder/file name) |
title | Plugin display name |
author | Plugin author |
version | Installed version |
status | active, inactive, must-use, dropin |
description | Plugin description (from header) |
author_uri | Author website URL |
plugin_uri | Plugin homepage URL |
network | Requires network activation flag |
requires_wp | Minimum WordPress version required |
requires_php | Minimum PHP version required |
update | available or none |
update_version | Available update version number |
auto_update | on 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
| Feature | wp plugin get | wp plugin status |
|---|---|---|
| Raw file header data | ✅ | ❌ |
requires_wp / requires_php fields | ✅ | ❌ |
plugin_uri / author_uri | ✅ | ❌ |
| Scriptable JSON output | ✅ | Partial |
| Summary view of all plugins | ❌ | ✅ |
| Better for audit scripting | ✅ | ❌ |
Best Practices
- Use
--field=versionin scripts instead of parsing full output. - Use
--format=jsonfor machine-readable output in automation pipelines. - Use
--fieldsto limit output to only what you need — faster and cleaner. - Loop over
wp plugin list --field=nameto build per-plugin reports withwp plugin get.
Troubleshooting
| Problem | Cause | Fix |
|---|---|---|
Error: The plugin could not be found | Wrong slug | Check with wp plugin list --field=name |
| Empty field values | Plugin header missing that field | Not all plugins declare all header fields |
requires_php not shown | Old plugin format | Check 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
wp plugin status— human-friendly status overview.wp plugin list— compare all plugins at once.wp plugin path— get the filesystem path to the plugin.