Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

wp rest api remove _links

function devotees_rest_prepare_post($data, $post, $request)
{
    foreach($data->get_links() as $_linkKey => $_linkVal) 
    {
        $data->remove_link($_linkKey);
    }
    return $data;
}

add_filter('rest_prepare_post', 'devotees_rest_prepare_post', 1, 3);
// Custom Post Type: slug => imap
add_filter('rest_prepare_imap', 'devotees_rest_prepare_post', 1, 3);
 
PREVIOUS NEXT
Tagged: #wp #rest #api #remove
ADD COMMENT
Topic
Name
6+9 =