wp taxonomy

Получение сведений о зарегистрированных таксономиях.

Список команд Описание
wp taxonomy list Список зарегистрированных таксономий.
wp taxonomy get Получает сведения о зарегистрированной таксономии.

Примеры

# List all taxonomies with 'post' object type.
$ wp taxonomy list --object_type=post --fields=name,public
+-------------+--------+
| name        | public |
+-------------+--------+
| category    | 1      |
| post_tag    | 1      |
| post_format | 1      |
+-------------+--------+

# Get capabilities of 'post_tag' taxonomy.
$ wp taxonomy get post_tag --field=cap
{"manage_terms":"manage_categories","edit_terms":"manage_categories","delete_terms":"manage_categories","assign_terms":"edit_posts"}

Исходный код команд


wp taxonomy list

Список зарегистрированных таксономий.

Использование

wp taxonomy list [--{field}={value}] [--field={field}] [--fields={fields}] [--format={format}]

Можно указать Глобальные параметры и следующие:

[--{field}={value}]
Filter by one or more fields (see get_taxonomies() first parameter for a list of available fields).
[--field={field}]
Prints the value of a single field for each taxonomy.
[--fields={fields}]
Limit the output to specific taxonomy fields.
[--format={format}]

Render output in a particular format.
По умолчанию: table
Может быть:

  • table
  • csv
  • json
  • count
  • yaml

Доступные поля

These fields will be displayed by default for each term:

  • name
  • label
  • description
  • public
  • hierarchical

There are no optionally available fields.

Примеры

# List all taxonomies.
$ wp taxonomy list --format=csv
name,label,description,object_type,show_tagcloud,hierarchical,public
category,Categories,,post,1,1,1
post_tag,Tags,,post,1,,1
nav_menu,"Navigation Menus",,nav_menu_item,,,
link_category,"Link Categories",,link,1,,
post_format,Format,,post,,,1
# List all taxonomies with 'post' object type.
$ wp taxonomy list --object_type=post --fields=name,public
+-------------+--------+
| name        | public |
+-------------+--------+
| category    | 1      |
| post_tag    | 1      |
| post_format | 1      |
+-------------+--------+

wp taxonomy get

Получает сведения о зарегистрированной таксономии.

Использование

wp taxonomy get {taxonomy} [--field={field}] [--fields={fields}] [--format={format}]

Можно указать Глобальные параметры и следующие:

{taxonomy}
Taxonomy slug.
[--field={field}]
Instead of returning the whole taxonomy, 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.
По умолчанию: table
Может быть:

  • table
  • csv
  • json
  • yaml

Примеры

# Get details of `category` taxonomy.
$ wp taxonomy get category --fields=name,label,object_type
+-------------+------------+
| Field       | Value      |
+-------------+------------+
| name        | category   |
| label       | Categories |
| object_type | ["post"]   |
+-------------+------------+
# Get capabilities of 'post_tag' taxonomy.
$ wp taxonomy get post_tag --field=cap
{"manage_terms":"manage_categories","edit_terms":"manage_categories","delete_terms":"manage_categories","assign_terms":"edit_posts"}