I'm trying to restrict get_fields for User types to only those that can edit_posts. I have the show_in_rest option enabled, but I think it's overriding the filter I setup below.
// Enable the option show in rest
add_filter( 'acf/rest_api/field_settings/show_in_rest', '__return_true' );
// Restrict get_fields of Users
add_filter( 'acf/rest_api/users/get_fields', function( $data, $request ) {
if (!current_user_can( 'edit_posts' )) return false;
return $data;
});
Hi, thanks for developing this plugin.
I'm trying to restrict get_fields for User types to only those that can
edit_posts
. I have theshow_in_rest
option enabled, but I think it's overriding the filter I setup below.Any help much appreciated.