WordPress REST API error
WordPress REST API rest_no_route.
This error means WordPress REST routing did not find a route that matches the namespace, path, and HTTP method you requested.
Failure stage
WordPress reached: the request hit REST routing.
Failed first: route lookup did not match namespace, path, plugin registration, or method.
Not reached yet: authentication, permission callback, and route callback logic.
Route lookup matrix
| Evidence | Likely cause | First check |
|---|---|---|
rest_no_route with correct domain | Namespace/path mismatch | Compare the URL to the registered namespace and route. |
GET works, POST returns rest_no_route | Method mismatch | Confirm the route registered POST, not only GET. |
| Custom plugin route missing | Plugin inactive or registration hook wrong | Register routes on rest_api_init. |
/wp-json/ homepage works, route fails | Specific endpoint absent | Inspect the REST index for the namespace. |
| Pretty route fails, query route works | Rewrite/permalink issue | Test ?rest_route=/namespace/v1/path. |
Bad route pattern
URL called:
/wp-json/myplugin/v1/save
Route registered:
register_rest_route('my-plugin/v1', '/save', ...)
The missing dash in the namespace is enough to make WordPress return rest_no_route.
Corrected pattern
// Pattern to verify in your environment.
add_action('rest_api_init', function () {
register_rest_route('my-plugin/v1', '/save', [
'methods' => 'POST',
'callback' => 'my_plugin_save',
'permission_callback' => function () {
return current_user_can('edit_posts');
},
]);
});
POST /wp-json/my-plugin/v1/save