Just days before the first conference dedicated to the REST API, we bring you: 2.0 Beta 11 “Give me a white wine spritzer!”. Download it from the plugin repository or from GitHub.
Here are some highlightsbreaking changes from the changelog:
- Moves Post->Term relations to the Post Resource. Previously, a client would fetch a Post’s Tags with
GET /wp/v2/posts/<id>/tags. In Beta 11, an array of term ids is included on the Post resource. The collection of terms for a Post can be fetched withGET /wp/v2/tags?post=<id>. TheWP_REST_Posts_Terms_Controllerclass no longer exists. - Changes
featured_imageattribute on Posts tofeatured_media. While featuring other attachment types isn’t yet officially supported, this makes it easier for us to introduce the possibility in the future. - Uses discrete schema title for categories and tags. If you’ve used
register_rest_field( 'term' ), you’ll need to change'term'to'tag'and/or'category'. - Makes many filters dynamic based on the controller type. If you were using the
rest_prepare_termfilter, you’ll need to change it torest_prepare_post_tagorrest_prepare_category. If you were usingrest_post_queryorrest_terms_query, you’ll need update your use torest_page_query, etc. If you were usingrest_post_trashable,rest_insert_postorrest_delete_post, they are now dynamic based on the post type slug.
As always, we have a detailed changelog as well as the full set of changes if you’re interested.
WP REST API: Version 2.0 Beta 11 by Daniel Bachhuber was originally posted at https://make.wordpress.org/core/2016/01/26/wp-rest-api-version-2-0-beta-11/
No comments:
Post a Comment