wp rest api v2 return json_no_route

OK, i find my answer.
Just ask it here and as dear Charles sayed, they answered me, so fast, the answer is:

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';
});

and because i am not a WordPress guy, so i don’t know where should i add this lines so i get help from this blog and add the lines to the

function.php

of my them.

Leave a Comment