1

I'm trying to add featured images to my API but it's a different type of post.

http://example.com/wp-json/wp/v2/directory

I have been using WP REST API Controller but it doesn't show image option.

I also try to use "Better REST API Featured Images" but no luck.

It's starting to annoy me.

5

1 Answer 1

0

from the support forum of that plugin:

Your cpt may not be registered correctly. Try adding this to your functions.php (change "event" to your post type slug):

add_filter( 'register_post_type_args', function( $args, $post_type ) {

if( 'event' === $post_type ) {
    $args['show_in_rest'] = true;
}

return $args;

}, 10, 2 );

or make sure that you have show in rest active for your cpt when you actually registered it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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