gravityflowincomingwebhook_route_args

Description

The gravityflowincomingwebhook_route_args filter allows developers to modify the arguments used when registering the REST API route for incoming webhooks in the Gravity Flow Incoming Webhook extension.

Usage

1
add_filter( 'gravityflowincomingwebhook_route_args', 'your_function_name', 10, 1 );

Parameters

ParameterTypeDetails
$route_argsarrayThe array of arguments used to register the webhook endpoint.

Examples

Add a custom argument to the webhook REST route.

1
2
3
4
5
6
7
8
9
10
11
12
add_filter( 'gravityflowincomingwebhook_route_args', 'sb_gravityflowincomingwebhook_route_args' );
function sb_gravityflowincomingwebhook_route_args( $route_args ) {
    // Add a custom argument 'desig' to the REST endpoint
    $route_args['args']['desig'] = array(
        'required'          => true,
        'sanitize_callback' => 'sanitize_text_field',
        'description'       => __( 'Submitter designation can be validated by gravityflowincomingwebhook_check_permissions )', 'text-domain' ),
        'type'              => 'string',
        );
     
    return $route_args;
}

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 gravityflowincomingwebhook/class-incoming-webhook.php