airesvsg / acf-to-rest-api

Exposes Advanced Custom Fields Endpoints in the WordPress REST API
https://wordpress.org/plugins/acf-to-rest-api/
1.32k stars 111 forks source link

Customize return data for a single custom type #375

Open dzoni-quantox opened 3 years ago

dzoni-quantox commented 3 years ago

Hi guys, WP newbie here.

I have a custom type called activities, and I'm wandering how can I manipulate the data that this route /v2/activities/5837 returns?

It's a route generated by the plugin, and it returns the activity with id = 5837. What I want to do is prevent returning a parameter in the acf array if the user is not admin. Namely, I don't want to show the participants.

I presume I need to put some sort of filter somewhere. Any help would be much appreciated.

af