I’ve been trying for a full day to get a really basic install of the WP-API to answer to a custom post type (in this case called ‘transactions’).
The post type is set up and fully public, and it’s existence is acknowledged by querying example.com/wp-json/posts/types/transactions
.
I’m getting the expected response from example.com/wp-json/posts?type=page
but a 403 when trying to access example.com/wp-json/posts?type=transactions
.
I really can’t think of anything else to try! If anyone has any advice I’d really appreciate it. I’m running the site on nginx, PHP v5.4 if it makes any difference.
1 Answer
In version 1.1 of the JSON REST API custom post type endpoints have to be registered manually. See: http://wp-api.org/guides/extending.html#registering-your-endpoints
In version 2.0 we register endpoints for any custom post types registered with the show_in_rest
property set to true
. Documentation on how to do this: http://v2.wp-api.org/extending/custom-content-types/#registering-a-custom-post-type-with-rest-api-support