gravityflowchecklists_rest_api_capability_update_user_exemption

Description

The gravityflowchecklists_rest_api_capability_update_user_exemption filter allows the capability required to update user exemptions via the REST API to be modified.

Note: The filter name was originally published with a typo (graityflowchecklists_rest_api_capability_update_user_exemption). The correct version has been added in version 1.8.0, but the original is still supported for backwards compatibility.

Usage

add_filter( 'gravityflowchecklists_rest_api_capability_update_user_exemption.', 'custom_function', 10, 2 );

Parameters

ParameterTypeDetails
$capabilitystringThe capability required. Default: ‘gravityflowchecklists_user_admin’
$requestWP_REST_RequestThe REST API request object

Examples

Modify the capability required for REST API access.

add_filter( 'gravityflowchecklists_rest_api_capability_update_user_exemption', 'gfw_custom_rest_api_capability', 10, 2 );
function gfw_custom_rest_api_capability( $capability, $request ) {
    // Replace with your desired capability
    $capability = 'manage_options';
    
    return $capability;
}

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?

Source Code

This filter is located in gravityflowchecklists/includes/class-rest-api.php