WP-API / rest-filter-response-fields

Legacy plugin; use ?_fields= instead of installing this!

Home Page:https://core.trac.wordpress.org/ticket/38131

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NOTE: This plugin was created to test a feature which has since landed in WordPress core. To request specific fields with your REST API response, you may use the _fields query parameter introduced in WordPress 4.9.

Usage:

Example Query Result
/wp/v2/posts?_fields=id,title Return a posts collection where each post includes only the id property and title object.
/wp/v2/media?_fields=source_url Return a media collection where each object includes only the source_url.
/wp/v2/tags?_fields[]=slug&_fields[]=id Return tag objects with only the id and slug properties.

As noted in the above examples, the core implementation supports using query parameter array syntax or a comma-separated list.

Legacy plugin README below, for posterity.


REST Filter Response Fields

Specify fields for the response JSON. See https://core.trac.wordpress.org/ticket/38131.

Use by specifying the fields you want as part of the request as a comma delimited list: ?fields=title,excerpt.

About

Legacy plugin; use ?_fields= instead of installing this!

https://core.trac.wordpress.org/ticket/38131

License:GNU General Public License v2.0


Languages

Language:Shell 63.5%Language:PHP 36.5%