Open jasonagnew opened 8 years ago
Great work on the plugin. I was wondering if it would be worth having a way to filter the option fields, like you do with the standard rest_prepare_x. Maybe adding the filter to addACFOptionRouteV2cb
rest_prepare_x
addACFOptionRouteV2cb
return apply_filters( 'rest_prepare_acf_options', $request, $fields, $option );
Allowing you to do:
function remove_private_options($request, $fields, $option) { $private_prefix = '_private_'; if ( substr($option, 0, strlen($private_prefix) ) === $private_prefix ) { return false; } foreach($fields as $name => $value) { if ( substr($name, 0, strlen($private_prefix) ) === $private_prefix ) { unset($fields[$name]); } } return $fields; }
Above is an example of removing any field in the options with a prefix of _private_
_private_
Great work on the plugin. I was wondering if it would be worth having a way to filter the option fields, like you do with the standard
rest_prepare_x
. Maybe adding the filter toaddACFOptionRouteV2cb
return apply_filters( 'rest_prepare_acf_options', $request, $fields, $option );
Allowing you to do:
Above is an example of removing any field in the options with a prefix of
_private_