rest_no_route 📝 WordPress

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

  1. List routes: GET /wp-json/
  2. Register with register_rest_route on rest_api_init
  3. Use the right method or add it to the route

Detailed fix by platform

WordPress

  1. 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

  1. Index — Route listed in /wp-json?
  2. Method — Allowed methods
  3. 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:

🧠 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.