Wp plugin get (WP-CLI)

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen
$ wp help plugin get

NAME

  wp plugin get

DESCRIPTION

  Gets details about an installed plugin.

SYNOPSIS

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

OPTIONS

  <plugin>
    The plugin to get.

  [--field=<field>]
    Instead of returning the whole plugin, returns the value of a single field.

  [--fields=<fields>]
    Limit the output to specific fields. Defaults to all fields.

  [--format=<format>]
    Render output in a particular format.
    ---
    default: table
    options:
      - table
      - csv
      - json
      - yaml
    ---

EXAMPLES

    $ wp plugin get bbpress --format=json
    {"name":"bbpress","title":"bbPress","author":"The bbPress
    Contributors","version":"2.6-alpha","description":"bbPress is forum software with a twist from the creators of
    WordPress.","status":"active"}

This might come handy, e.g., if I need to know the version of a plugin, prior to 'manual' updates.

Examples

General:

$ wp plugin get wp-rocket
+-------------+----------------------------------------+
| Field       | Value                                  |
+-------------+----------------------------------------+
| name        | wp-rocket                              |
| title       | WP Rocket                              |
| author      | WP Media                               |
| version     | 3.14.4.2                               |
| description | The best WordPress performance plugin. |
| status      | active                                 |
+-------------+----------------------------------------+

To fetch only the version. Note that the output isn't formatted as a table. That might come handy:

$ wp plugin get wp-rocket --field=version
3.15.4

To see --fields vs. --field in action:

$ wp plugin get wp-rocket --fields=name,version
+---------+-----------+
| Field   | Value     |
+---------+-----------+
| name    | wp-rocket |
| version | 3.15.4    |
+---------+-----------+

Ah, I get it: With --field, output is without formatting, as it is quite clear that this value will be further processed. However, if you do want a nice ASCII-table around your output of only one field, use --fields with only one argument:

$ wp plugin get wp-rocket --fields=name
+-------+-----------+
| Field | Value     |
+-------+-----------+
| name  | wp-rocket |
+-------+-----------+