Skip to content
Docs
Get RestroPress

Filter

rp_api_not_enabled_error_message

Updated
On this page

Filters the error message returned when the token endpoint is not enabled.

Used in the REST auth controller permission check when the Enable Token Endpoint setting is off. The message is returned in a WP_Error with the rest_forbidden code.

Parameters#

ParameterTypeDescription
$messagestringDefault message, 'API has not enabled!!!.'.
$requestWP_REST_RequestThe current REST request.

Return value#

string. The error message.

Example#

function my_api_not_enabled_message( $message, $request ) {
	return __( 'The API is currently disabled.', 'my-textdomain' );
}
add_filter( 'rp_api_not_enabled_error_message', 'my_api_not_enabled_message', 10, 2 );

Source#

Applied in:

  • includes/rest-api/Controllers/Version1/class-rp-rest-auth-v1-controller.php (line 229), in RP_REST_Auth_V1_Controller::get_auth_permissions_check()

See also#

Was this page helpful?