wp warning about permission_callback is missing for rest route
-
Howdy,
if you make a request on of your plugin routes like /jwt-auth/v1/token/validate/
wordpress write in the response headers: x-wp-doingitwrong:“register_rest_route was called incorrectly. The REST API route definition for
jwt-auth/v1/token/validate
is missing the required permission_callback argument. For REST API routes that are intended to be public, use __return_true as the permission callback.”The Solution is just add one line per route:
register_rest_route($this->namespace, 'token/validate', array( 'methods' => 'POST', 'callback' => array($this, 'validate_token'), 'permission_callback' => '__return_true', // <-- add this ));
Thank you ??
- The topic ‘wp warning about permission_callback is missing for rest route’ is closed to new replies.