Happy Tuesday 🙂 The WP REST API team is proud to bring you: 2.0 Beta 12 “Canyonero”. Download it from the plugin repository or from GitHub.
Here are some
highlights from the changelog:
Removes meta endpoints from primary plugin. If your project depends on post meta endpoints, please install WP REST API Meta Endpoints. For the gory history of meta, read #1425 and linked issues. At this time, we recommend using
register_rest_field() to expose meta (docs).
Returns original resource when deleting PTCU. Now that all resources require the
force param, we don’t need to wrap delete responses with the
roles rather than
role in the Users controller. Building the REST API gives us the opportunity to standardize on
roles, instead of having both
Moves to consistent use of
context throughout controllers. Contexts limit the data present in the response. Here’s how to think of them:
embed correlates with sidebar representation,
view represents the primary public view, and
edit is the data expected for an editor.
post_* query param support for
GET /wp/v2/comments. The proper pattern is to use
GET /wp/v2/posts to fetch the post IDs to limit the request to.
rest_sanitize_request_arg(). Dedicated functions means we can use them for validating / sanitizing query args too. Removes
As always, we have a detailed changelog as well as the full set of changes if you’re interested.
What’s the future of the WP REST API? I’d like to leave you with this final thought:
What came first, the chicken or the egg?
I egged the chicken, and then I ate his leg