Just days before the first conference dedicated to the REST API, we bring you: 2.0 Beta A pre-release of software that is given out to a large group of users to trial under real conditions. Beta versions have gone through alpha testing in-house and are generally fairly close in look, feel and function to the final product; however, design changes often occur as part of the process. 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 with
GET /wp/v2/tags?post=<id>. The
WP_REST_Posts_Terms_Controller class no longer exists.
featured_image attribute on Posts to
featured_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
- Makes many filters dynamic based on the controller type. If you were using the
rest_prepare_term filter Filters are one of the two types of Hooks https://codex.wordpress.org/Plugin_API/Hooks. They provide a way for functions to modify data of other functions. They are the counterpart to Actions. Unlike Actions, filters are meant to work in an isolated manner, and should never have side effects such as affecting global variables and output., you’ll need to change it to
rest_prepare_category. If you were using
rest_terms_query, you’ll need update your use to
rest_page_query, etc. If you were using
rest_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.