[ad_1]
hi
i have a custom post type book, and in its args i have
'show_in_rest' => true,now i want to add a custom field to it like so:
add_action( 'init', 'add_to_rest_test' );
function add_to_rest_test(){
$meta_args = array(
'type' => 'string',
'description' => 'A meta key associated with a string meta value.',
'single' => true,
'show_in_rest' => true,
);
register_post_meta( 'book', 'testing_field', $meta_args );
}but then when i go to the post json: myexamplesite/wp-json/wp/v2/book…. there is no “meta” section. But if i change the code to regular post:
register_post_meta( 'post', 'testing_field', $meta_args );in the json i do have a meta section:
"meta": {
"testing_field": "",
"footnotes": ""
},what am i missing here? appriciate any help
