Question

Very basic question, but I couldn't find an answer.

I am using the WP CLI post get command: https://wp-cli.org/commands/post/get/

One of the option is [--field=], but I can't find in the doc the list of allowed values for this field.

What am I missing?

Was it helpful?

Solution

The list of fields is available on the wp post list page.

These fields will be displayed by default for each post:

ID
post_title
post_name
post_date
post_status

These fields are optionally available:

post_author
post_date_gmt
post_content
post_excerpt
comment_status
ping_status
post_password
to_ping
pinged
post_modified
post_modified_gmt
post_content_filtered
post_parent
guid
menu_order
post_type
post_mime_type
comment_count
filter
url

OTHER TIPS

Right, I think you have not see example section or the example section is available now.

If you want to display only one field then you can use --field parameter.

E.g

wp post list --field=ID

And to get multiple fields then you can use --fields parameter.

E.g.

wp post list --fields=post_title,post_status

--field is associated argument. Read more about the associate arguments at https://wp.me/p4Ams0-1g1

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top