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 highlightsbreaking changes 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 thetrash
state. - Uses
roles
rather thanrole
in the Users controller. Building the REST API gives us the opportunity to standardize onroles
, instead of having bothroles
androle
. - 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, andedit
is the data expected for an editor. - Removes
post_*
query param support forGET /wp/v2/comments
. The proper pattern is to useGET /wp/v2/posts
to fetch the post IDs to limit the request to. - Introduces
rest_validate_request_arg()
/rest_sanitize_request_arg()
. Dedicated functions means we can use them for validating / sanitizing query args too. RemovesWP_REST_Controller::validate_schema_property()
andWP_REST_Controller::sanitize_schema_property()
.
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
WP REST API: Version 2.0 Beta 12 by Daniel Bachhuber was originally posted at https://make.wordpress.org/core/2016/02/09/wp-rest-api-version-2-0-beta-12/
No comments:
Post a Comment