WordPress REST API: {"code":"rest_no_route","message":"No route was found matching the URL and request method."}
The REST endpoint doesn’t exist for that URL and HTTP method — wrong namespace/route, plugin not active, or route registered too late.
Seen on:
WordPress
Meaning
Routes must be registered on rest_api_init. Typos in the namespace, using GET where only POST is registered, disabled plugins, or permalinks set to Plain (requiring ?rest_route=) cause it.
Common causes
- Route registered outside rest_api_init or not at all
- Wrong method for the route
- Plugin providing the route inactive
- Plain permalinks (use ?rest_route=/ns/route)
⚡ Quick fix
- List routes: GET /wp-json/
- Register with register_rest_route on rest_api_init
- Use the right method or add it to the route
Detailed fix by platform
WordPress
- php
add_action('rest_api_init', function () { register_rest_route('myplugin/v1', '/items', [ 'methods' => 'GET', 'callback' => 'myplugin_items', 'permission_callback' => '__return_true', ]); });
How to diagnose
- Index — Route listed in /wp-json?
- Method — Allowed methods
- Permalinks — Plain?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in WordPress
Other ways to find it
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 7 Oct 2026