3

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.

  • 2
    @cybmeta The question is regarding the WP REST API, a "feature plugin" to bring a JSON-based REST API to WordPress core. – Rachel Baker Feb 15 '15 at 18:49
  • In version 1.1 of the JSON REST API custom post type endpoints have to be registered manually. wp-api.org/guides/extending.html#registering-your-endpoints Improving this process is one of the enhancements we are making to the upcoming release of the plugin. – Rachel Baker Feb 15 '15 at 18:56
  • @RachelBaker many thanks for this! Have seen so much conflicting information with examples that made it look like I was really missing something simple. Much appreciated. – greypiglet Feb 16 '15 at 9:31
1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.