I have a term field created with types plugin and attached to the “category” taxonomy. I need to get this field in the api rest. You cant get the termmeta in types plugin like this
types_render_termmeta($slug_term, array("term_id" => $term_id));
I don’t know how to get current category id in register_rest_field
function.
register_rest_field( 'category', 'color', array(
'get_callback' => function() {
$term_id = "DONT KNOW HOW TO GET IT";
$color = types_render_termmeta('color-de-categoria', array("term_id" => $term_id));
return $color;
}
));
Thanks in advanced.