gform_rest_api_capability_post_forms

gform_rest_api_capability_post_forms

DescriptionUsageParametersExamplePlacementSinceSource Code

Description
Filters the capability required to create forms via the Rest API V2.
Usage
1add_filter( 'gform_rest_api_capability_post_forms', 'your_function_name', 10, 2 );

Parameters

$capability string
The capability required. Defaults to 『gravityforms_create_form』.

$request WP_REST_Request
Full data about the request.

Example
12345add_filter( 'gform_rest_api_capability_post_forms', 'get_post_forms_capability', 10, 2 );function get_post_forms_capability( $capability, $request ) {   return 'my_custom_capability'; }
Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in Gravity Forms 2.4.
Source Code
This filter is located in GF_REST_Forms_Controller::create_item_permissions_check() in includes/webapi/v2/includes/controllers/class-controller-forms.php.

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注