Add custom post type visible to WP REST API.
-
I have created a custom post type with the plugin https://wordpress.org/plugins/types/
The post type sigular name is “question”, and it has a custom field group.
add_action( 'init', 'my_question' ); function my_question() { $args = array( 'public' => true, 'show_in_rest' => true, 'label' => 'questions' ); register_post_type( 'questions', $args ); }I tried this to get the result when i call the end point /wp-json/wp/v2/questions, but i get empty json array.
I havecreated two question posts and those are published.Any help please?
The topic ‘Add custom post type visible to WP REST API.’ is closed to new replies.