Custom post types in v2 of the WordPress REST API

Scott Bolinger has a very useful post that describes changes between v1 and v2 of the WordPress REST API in regard to custom post types.

In v1, custom post types were made available by default, whereas now they need to be made visible in the list of arguments available upon post type registration. So you would include an argument of 'show_in_rest' => true.

If you built something in version 1, you'll want to be on the lookout for this and other changes in version 2. As scott notes, the v2 documentation is the best place to go for accurate information, but it too is a working document and if you're interested in documenting the REST API, I'm sure the team would love to hear from you.

Similar Posts