jjgrainger/wp-custom-post-type-class

post type to enable in wp-api

lgt opened this issue · 4 comments

lgt commented

I just read that wp-api 2 does not supports from default custom type. This one needs to be enabled by passed $args like 'show_in_rest' => true,. How would I do that?

Sorry I don't quite understand, I'm not very familiar with WP-API, could you give me the link to what you're referring to so I can look into it.

Thanks :)

I just did a quick search,

I believe you just need to add it to the second parameter when creating the post type, for example

$books = new CPT('book', array(
    'show_in_rest' => true
));

@lgt can you try this out and see if it works for you?

lgt commented

I got it between thank you. Great Class!

No problem and thanks! :)