wp post-type
Извлекает сведения о зарегистрированных типах записей сайта.
Get information on WordPress’ built-in and the site’s custom post types.
| Список команд | Описание |
|---|---|
| wp post-type list | Список зарегистрированных типов записей. |
| wp post-type get | Получает сведения о зарегистрированном типе записи. |
Примеры
# Get details about a post type
$ wp post-type get page --fields=name,label,hierarchical --format=json
{"name":"page","label":"Pages","hierarchical":true}
# List post types with 'post' capability type
$ wp post-type list --capability_type=post --fields=name,public
+---------------+--------+
| name | public |
+---------------+--------+
| post | 1 |
| attachment | 1 |
| revision | |
| nav_menu_item | |
+---------------+--------+
Исходный код команд
wp post-type list
Список зарегистрированных типов записей.
Использование
wp post-type list [--{field}={value}] [--field={field}] [--fields={fields}] [--format={format}]
Можно указать Глобальные параметры и следующие:
- [--{field}={value}]
- Filter by one or more fields (see get_post_types() first parameter for a list of available fields).
- [--field={field}]
- Prints the value of a single field for each post type.
- [--fields={fields}]
- Limit the output to specific post type 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
- hierarchical
- public
- capability_type
There are no optionally available fields.
Примеры
# List registered post types $ wp post-type list --format=csv name,label,description,hierarchical,public,capability_type post,Posts,,,1,post page,Pages,,1,1,page attachment,Media,,,1,post revision,Revisions,,,,post nav_menu_item,"Navigation Menu Items",,,,post
# List post types with 'post' capability type $ wp post-type list --capability_type=post --fields=name,public +---------------+--------+ | name | public | +---------------+--------+ | post | 1 | | attachment | 1 | | revision | | | nav_menu_item | | +---------------+--------+
wp post-type get
Получает сведения о зарегистрированном типе записи.
Использование
wp post-type get {post-type} [--field={field}] [--fields={fields}] [--format={format}]
Можно указать Глобальные параметры и следующие:
- {post-type}
- Post type 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 about the 'page' post type.
$ wp post-type get page --fields=name,label,hierarchical --format=json
{"name":"page","label":"Pages","hierarchical":true}