Skip to content
Docs
Get RestroPress

Filter

rp_api_token_not_string_error_message

Updated
On this page

Filters the error message returned when the supplied API token is not a string.

Used in the JWT verifier when a token is present in the request but is not a string. The message is returned in a rest_forbidden WP_Error.

Parameters#

ParameterTypeDescription
$messagestringDefault message, 'Token is not a string!!!'.

Return value#

string. The error message.

Example#

function my_token_not_string_message( $message ) {
	return __( 'Invalid token format.', 'my-textdomain' );
}
add_filter( 'rp_api_token_not_string_error_message', 'my_token_not_string_message' );

Source#

Applied in:

  • includes/rest-api/Utilities/RP_JWT_Verifier.php (line 39), in RP_JWT_Verifier::incoming_token_verify()

See also#

Was this page helpful?