Register Rest field don’t work
-
Why register_rest_field not working for cusrom end points ? how to make it work for custom end ponts of custom post types.
add_action( 'rest_api_init', function () { register_rest_route( 'reviews/v1', '/(?P<id>\d+)', array( 'methods' => 'GET', 'callback' => 'get_course_reviews', 'show_in_rest' => true, 'rest_controller_class' => 'WP_REST_Posts_Controller' ) ); } );
register_rest_field( 'reviews/v1', 'is_sset_img', array( 'get_callback' => 'is_sset_img', 'update_callback' => null, 'schema' => null, ) ); }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Register Rest field don’t work’ is closed to new replies.