Skip to content
This repository has been archived by the owner on Sep 24, 2018. It is now read-only.

json_no_route #2343

Closed
miladna7 opened this issue Mar 4, 2016 · 2 comments
Closed

json_no_route #2343

miladna7 opened this issue Mar 4, 2016 · 2 comments
Labels

Comments

@miladna7
Copy link

miladna7 commented Mar 4, 2016

i am using WP rest API v1 and everything is ok.
But now i want taste some WP rest API v2. the problem is, when i any route/path, and i mean any route, the result is:
[{"code":"json_no_route","message":"\u0647\u06cc\u0686 \u0645\u0633\u06cc\u0631 \u062a\u0637\u0628\u06cc\u0642 URL \u0648 \u0631\u0648\u0634 \u062f\u0631\u062e\u0648\u0627\u0633\u062a \u067e\u06cc\u062f\u0627 \u0634\u062f"}]

So i try somethings, so i find out the reason is, i use wp rest api v1 and v2 together. when i remove wp rest api v1, the v2 return the normal result.

: i can't remove v1 because it is easy to work and i need v2 because i want to add a rote to get all the post IDs(just post IDs).

@danielbachhuber
Copy link
Member

By default, WP-API v1 takes priority over v2. If v1 is installed and activated, then v2 routes are inaccessible.

To mitigate this, you'll need to register either v1 or v2 to a different base than wp-json. Both have filters to make this more or less easily possible:

add_filter( 'rest_url_prefix', function() {
    return 'wp-api';
});

@chiragjak
Copy link

v2 has same problem with me says no rout found

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants