Filter
rpress_api_public_query_modes
On this page
Filters the API query modes that can be accessed without an API key.
Runs when the API checks whether a request is public. The default list contains only products. Requests for a listed query mode skip authentication unless a token is sent, so add modes with care because their data becomes readable by anyone.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$public_modes | array | Query mode slugs that do not require authentication. |
Return value#
array. The list of public query mode slugs.
Example#
function my_api_public_query_modes( $public_modes ) {
$public_modes[] = 'info';
return $public_modes;
}
add_filter( 'rpress_api_public_query_modes', 'my_api_public_query_modes' );
Notes#
Anything added here is exposed without authentication.
Source#
Applied in:
includes/api/class-rpress-api.php(line 292), inRPRESS_API::is_public_query()
See also#
Was this page helpful?
