PenciDesign Supporter replied
Staff Reply
Hi,
Please install the Code Snippet plugin, then add the following code:
function waerp_filter_post_json( $data, $post, $context ) {
$postmetas = get_post_meta($post->ID);
foreach($postmetas as $meta_key=>$meta_value) {
$data->data[$meta_key] = $meta_value[0];
}
return $data;
}
add_filter( 'rest_prepare_post', 'waerp_filter_post_json', 10, 3 );This code will return all custom meta keys of post type name: post in REST API result.
Best Regards,
PenciDesign.