json_no_route when querying taxonomy with WP-API

Resources on WordPress json_no_route when querying taxonomy with WP-API

To get a taxonomy, using WP-API, you should make a request to http://example.com/wp-json/taxonomies/category/

All is well, until you have a taxonomy with a dash(‘-‘) in its name – in my case, the taxonomy is called ‘event-categories’ – the default event taxonomy in the Events Manager plugin.

So, a request to http://example.com/wp-json/taxonomies/event-categories/ responds with a “No route was found matching the URL and request method” message.

It’s a pretty big, apparently known issue, and will hopefully be resolved soon. In case it’s not though, here is a temporary solution, stolen from GitHub user zkingdesign on this page:

 

Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *