I’m modifying the WP REST API for mobile app usage, and I went through at the first registering new fields route using the
rest_api_init action or hook using the func
register_rest_field, but I found there’s a lot of fields I don’t need it or wanted so I get rid of it by using the filter
What I found out is I can actually add new fields in my filter by modifying the data array and no needs for the
register_rest_field at all.
So what I am asking is what is the best approach for doing this? is it good to add and remove fields in one function instead of two? I’m now using both
register_route_field for the new fields and
unset all the unnecessary