Retrieve custom fields on Categories, using WP-API

I’ve added a single Advanced Custom Field to the categories taxonomy (that appears to work as expected) and am trying to retrieve it along with the categories using the REST API, via /wp-json/wp/v2/categories.

I’ve managed to customise the posts JSON returned, using the rest_prepare_post filter…

function prepare_restful_posts($data, $post, $request) {
    // Do stuff to $data
}
add_filter('rest_prepare_post', 'prepare_restful_posts', 10, 3);

…but I can’t seem to find any helpful information about how to customise the categories JSON.

Can someone possibly shed some light on this?

Read more here: Retrieve custom fields on Categories, using WP-API

Leave a Reply

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