Description
The gravityflow_members_capabilities filter allows developers to customize the list of capabilities registered by Gravity Flow for integration with the Members plugin or other role/capability management tools.
Usage
add_filter('gravityflow_members_capabilities', 'gfw_custom_function', 10, 1);
Parameters
| Parameter | Type | Details |
|---|---|---|
| $caps | array | The array of Gravity Flow capabilities. |
Examples
Add a Custom Named Capability.
This example demonstrates how to safely add a custom capability to the $caps array. It ensures that the value is an array before attempting to modify.
add_filter( 'gravityflow_members_capabilities', 'add_custom_gravityflow_capability' );
function add_custom_gravityflow_capability( $caps ) {
if ( is_array( $caps ) ) {
$caps['gravityflow_custom_capability'] = __( 'Custom Capability', 'text-domain' );
}
return $caps;
}
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 class-gravity-flow.php