Wp plugin list (WP-CLI)

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen

Obtain a list of installed plugins. I use this command quite often, e.g., to verify the names of plugins.

$ wp help plugin list

NAME

  wp plugin list

DESCRIPTION

  Gets a list of plugins.

SYNOPSIS

  wp plugin list [--<field>=<value>] [--field=<field>] [--fields=<fields>] [--format=<format>] [--status=<status>]
  [--skip-update-check]

  Displays a list of the plugins installed on the site with activation
  status, whether or not there's an update available, etc.

  Use `--status=dropin` to list installed dropins (e.g. `object-cache.php`).

OPTIONS

  [--<field>=<value>]
    Filter results based on the value of a field.

  [--field=<field>]
    Prints the value of a single field for each plugin.

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

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

  [--status=<status>]
    Filter the output by plugin status.
    ---
    options:
      - active
      - active-network
      - dropin
      - inactive
      - must-use
    ---

  [--skip-update-check]
    If set, the plugin update check will be skipped.

AVAILABLE FIELDS

  These fields will be displayed by default for each plugin:

  * name
  * status
  * update
  * version

  These fields are optionally available:

  * update_version
  * update_package
  * update_id
  * title
  * description
  * file

EXAMPLES

    # List active plugins on the site.
    $ wp plugin list --status=active --format=json
    [{"name":"dynamic-hostname","status":"active","update":"none","version":"0.4.2"},{"name":"tinymce-templates","status":"active","update":"none","version":"4.4.3"},{"name":"wp-multibyte-patch","status":"active","update":"none","version":"2.4"},{"name":"wp-total-hacks","status":"active","update":"none","version":"2.0.1"}]

    # List plugins on each site in a network.
    $ wp site list --field=url | xargs -I % wp plugin list --url=%
    +---------+----------------+--------+---------+
    | name    | status         | update | version |
    +---------+----------------+--------+---------+
    | akismet | active-network | none   | 3.1.11  |
    | hello   | inactive       | none   | 1.6     |
    +---------+----------------+--------+---------+
    +---------+----------------+--------+---------+
    | name    | status         | update | version |
    +---------+----------------+--------+---------+
    | akismet | active-network | none   | 3.1.11  |
    | hello   | inactive       | none   | 1.6     |
    +---------+----------------+--------+---------+

Examples

Easy:

wp plugin list

Only return one field: Met de optie --field krijg je cleane output - Handig bv. voor kopiëren-en-plakken naar een andere applicatie, of piping/redirecting.

wp plugin list --field=name

Output van meerdere velden: Gebruik optie --fields. Nu krijg je de gebruikelijke opmaak met 'karakter-tabellen'. Er mag geen spatie na de komma waarmee de namen van velden wordt gescheiden. Bv.:

wp plugin list --fields=name,title

+----------------------------------------------------+--------------------------------------------+
| name                                               | title                                      |
+----------------------------------------------------+--------------------------------------------+
| advanced-custom-fields-pro                         | Advanced Custom Fields PRO                 |
| advanced-woo-search-pro                            | Advanced Woo Search PRO                    |
| woocommerce                                        | WooCommerce                                |
| woocommerce-eu-vat-number                          | WooCommerce EU VAT Number                  |
| woocommerce-google-analytics-integration           | WooCommerce Google Analytics Integration   |
| woocommerce-quantity-increment                     | WooCommerce Quantity Increment             |
| wp-dbmanager                                       | WP-DBManager                               |
| wp-mail-smtp                                       | WP Mail SMTP                               |
| wpovernight-sidekick                               | WP Overnight Sidekick                      |
| wp-rocket                                          | WP Rocket                                  |
| wordpress-seo                                      | Yoast SEO                                  |
| mu-iwp-client                                      |                                            |
| redis-cache-pro                                    |                                            |
| 0-mu-wp-time-capsule                               |                                            |
| advanced-cache.php                                 |                                            |
| object-cache.php                                   | Object Cache Pro (Drop-in)                 |
+----------------------------------------------------+--------------------------------------------+

Merk op dat de MU-plugins (Must use) geen title hebben.

Meerdere velden - geen opmaak

wp plugin list --fields=name,title --format=csv

Als je precies wilt weten om welke plugin het gaat

$ wp plugin list --fields=name,title,description,version --name="woocommerce-eu-vat-number"

+---------------------------+---------------------------+--------------------------------------------------+---------+
| name                      | title                     | description                                      | version |
+---------------------------+---------------------------+--------------------------------------------------+---------+
| woocommerce-eu-vat-number | WooCommerce EU VAT Number | The EU VAT Number extension lets you collect and | 2.4.2   |
|                           |                           |  validate EU VAT numbers during checkout to iden |         |
|                           |                           | tify B2B transactions verses B2C. IP Addresses c |         |
|                           |                           | an also be validated to ensure they match the bi |         |
|                           |                           | lling address. EU businesses with a valid VAT nu |         |
|                           |                           | mber can have their VAT removed prior to payment |         |
|                           |                           | .                                                |         |
+---------------------------+---------------------------+--------------------------------------------------+---------+

Sources