Hi,
Is there a way, on a field by field basis, to enable/disable the REST API read capibility based on if the user is logged in or not?
I know i can check “Read via REST API” under the REST API setting on a field by field basis. But doing so makes it visible to anyone even if checking “Restrict access to Logged In Users” it will still show the field in the JSON-response found at /wp-json/wp/v2/sampleposttype even if logged out.
Or is there a filter that i can use to enable/disable some rest fields based on if user is logged in or not?
Let’s say enable the rest api read capibility on the fields phone and email for a certain post type if logged in else disable.
