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.
No route was found matching the URL and request method 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
- Critical error WordPress: There Has Been a Critical Error on This Website
- There was an error trying to send your message Contact Form 7: There was an error trying to send your message. Please try again later.
- Call to undefined function create_function() WordPress on PHP 8: Fatal error: Uncaught Error: Call to undefined function create_function() / each()
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 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.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 13 Oct 2026