Modify Custom Post Type Response

is that possible to modify custom post type response? I’ve already manage to modify response from normal post using rest_prepare_post filter , and it turn out great.

function prepare_restforvenue($data, $post, $request){

 $_data = $data->data;

 $cats = get_the_category($post->ID);

 $_data['cats'] = $cats;

 $data->data = $_data;

 return $data;} add_filter('rest_prepare_venue', 'prepare_restforvenue', 10, 3);

This query makes the changes to all posts but not allowing me to make changes in custom post type, as i have maked a custom post type named ‘VENUE’.I’ve only managed to query custom post type data but it doesn’t have any chaanges like normal post.

Read more here: Modify Custom Post Type Response

Leave a Reply

Your email address will not be published. Required fields are marked *