aam_content_access_controls_filter
Purpose
Add access-control fields to a content REST response.
Callback
- Type: Filter.
- Arguments:
$controls,$resource,$identifier. - Return: the filtered first argument.
Example
add_filter('aam_content_access_controls_filter', function ($controls, $resource, $identifier) {
if ($resource->type === 'post_type' && $identifier instanceof WP_Post_Type && $identifier->name === 'myapp_report') {
$controls['myapp_note'] = ['title' => 'MyApp note', 'description' => 'Extra access setting'];
}
return $controls;
}, 10, 3);
Adds a custom control to the myapp_report post type response. The identifier is a WordPress post type object here; taxonomy and term requests pass different object types.
See the complete hook list.