aam_cap_can_filter

Purpose

Control whether a capability may be updated, deleted, or toggled in REST.

Callback

Example

add_filter('aam_cap_can_filter', function ($allowed, $capability, $operation) {
    if ($capability === 'delete_users' && $operation === 'delete') {
        return false;
    }
    return $allowed;
}, 10, 3);

Prevents deletion of the named capability through the REST operation while retaining other decisions.

See the complete hook list.