Filter
rp_api_auth_error_message
On this page
Filters the error message returned when REST API authentication fails.
Used by the check_application_password_auth permission callbacks of the cart, customer, others, posts, reports and terms controllers when the request is neither authenticated by an application password nor by a logged-in user with the required capability. The message is returned in a rest_forbidden error.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$message | string | Default message, 'Authentication failed. Please check your credentials.'. |
Return value#
string. The error message.
Example#
function my_api_auth_message( $message ) {
return __( 'Access denied.', 'my-textdomain' );
}
add_filter( 'rp_api_auth_error_message', 'my_api_auth_message' );
Source#
Applied in:
includes/rest-api/Controllers/Version1/class-rp-rest-cart-v1-controller.php(line 376), inRP_REST_Cart_V1_Controller::check_application_password_auth()includes/rest-api/Controllers/Version1/class-rp-rest-customer-v1-controller.php(line 500), inRP_REST_Customer_v1_Controller::check_application_password_auth()includes/rest-api/Controllers/Version1/class-rp-rest-others-v1-controller.php(line 86), inRP_REST_Others_V1_Controller::check_application_password_auth()includes/rest-api/Controllers/Version1/class-rp-rest-posts-controller.php(line 90), inRP_REST_Posts_Controller::check_application_password_auth()includes/rest-api/Controllers/Version1/class-rp-rest-reports-v1-controller.php(line 110), inRP_REST_Reports_v1_Controller::check_application_password_auth()includes/rest-api/Controllers/Version1/class-rp-rest-terms-controller.php(line 90), inRP_REST_Terms_Controller::check_application_password_auth()
See also#
Was this page helpful?
