Home › Forums › ACF PRO › get_fields() but for Taxonomy › Reply To: get_fields() but for Taxonomy
Unfortunately, that’s not my result. I’m getting false
. Here’s my code that isn’t working. I’m trying to use the WP REST API to return custom fields on a custom Taxonomy called ‘region’ on a custom Post Type.
function regions_get_custom_fields_cb($object, $field_name, $request){
$thing = $object['slug'] . "_" . $object['id'];
return get_fields($thing);
}
add_action('rest_api_init', function(){
register_rest_field('region', 'custom_data',
array(
'get_callback' => 'regions_get_custom_fields_cb',
'update_callback' => null,
'schema' => null
)
);
});
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.