Wp term list (WP-CLI)

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen
$ wp help term list

NAME

  wp term list

DESCRIPTION

  Lists terms in a taxonomy.

SYNOPSIS

  wp term list <taxonomy>... [--<field>=<value>] [--field=<field>] [--fields=<fields>] [--format=<format>]

OPTIONS

  <taxonomy>...
    List terms of one or more taxonomies

  [--<field>=<value>]
    Filter by one or more fields (see get_terms() $args parameter for a list of fields).

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

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

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

VAILABLE FIELDS

  These fields will be displayed by default for each term:

  * term_id
  * term_taxonomy_id
  * name
  * slug
  * description
  * parent
  * count

  These fields are optionally available:

  * url

EXAMPLES

    # List post categories
    $ wp term list category --format=csv
    term_id,term_taxonomy_id,name,slug,description,parent,count
    2,2,aciform,aciform,,0,1
    3,3,antiquarianism,antiquarianism,,0,1
    4,4,arrangement,arrangement,,0,1
    5,5,asmodeus,asmodeus,,0,1

    # List post tags
    $ wp term list post_tag --fields=name,slug
    +-----------+-------------+
    | name      | slug        |
    +-----------+-------------+
    | 8BIT      | 8bit        |
    | alignment | alignment-2 |
    | Articles  | articles    |
    | aside     | aside       |
    +-----------+-------------+

[--field=<field>]

With [--field=<field>], you're supposed to be able to filter or so. Details aren't documented (it refers to a PHP function). Maybe this helps:

  • --field=ID Retrieves the ID of the object.
  • --field=name Retrieves the name of the object.
  • --field=slug Retrieves the slug of the object.
  • --field=description Retrieves the description of the object.
  • --field=parent Retrieves the parent ID of the object (applicable for hierarchical taxonomies).
  • --field=term_id Retrieves the term ID of the object (applicable for terms).
  • --field=object_ids: Retrieves the associated object IDs (applicable for terms).