Filter
rpress_api_valid_query_modes
On this page
Filters the list of accepted API query modes.
Runs when the API validates the requested endpoint. The default list is stats, products, customers, sales, discounts, file-fooditem-logs and info. A request for any mode not in the list is rejected with an Invalid query error and a 400 status. Add a mode here, and handle it in rpress_api_output_data.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$accepted | array | Accepted query mode slugs. |
Return value#
array. The list of accepted query mode slugs.
Example#
function my_api_valid_query_modes( $accepted ) {
$accepted[] = 'my-endpoint';
return $accepted;
}
add_filter( 'rpress_api_valid_query_modes', 'my_api_valid_query_modes' );
Source#
Applied in:
includes/api/class-rpress-api.php(line 530), inRPRESS_API::set_query_mode()includes/class-rpress-api.php(line 329), inRPRESS_API::get_query_mode()
See also#
Was this page helpful?
