wp-cli / restful

Unlocking the potential of the WP REST API at the command line

Home Page:https://wp-cli.org/restful/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot fetch a field property such as content.rendered

johnbillion opened this issue · comments

The following command returns the content of a post:

wp rest post get 1 --field=content

A problem that arises is that the content field is a JSON object containing properties such as rendered and private.

It's not possible to directly access these field properties in order to get their textual value. A utility such as jq has to be used on the CLI to drill down to a given property.

A syntax such as the following would be useful:

wp rest post get 1 --field=content.rendered

I'm amenable to using dot syntax here.

Closing for now, as this project isn't under active development.