Describe your question
I read the documentation about custom post type needing to be registered with rest API and I am trying to get several CPTs set for distributor. I found this code on the WP and added to my theme functions file but no change.
add_filter(` 'register_post_type_args', 'my_post_type_args', 10, 2 );
function my_post_type_args( $args, $post_type ) {
if ( 'book' === $post_type ) {
$args['show_in_rest'] = true;
// Optionally customize the rest_base or rest_controller_class
$args['rest_base'] = 'books';
$args['rest_controller_class'] = 'WP_REST_Posts_Controller';
}
return $args; }
Is there something I am missing?
Code of Conduct
Describe your question
I read the documentation about custom post type needing to be registered with rest API and I am trying to get several CPTs set for distributor. I found this code on the WP and added to my theme functions file but no change.
Is there something I am missing?
Code of Conduct