For example, entering /?json=1
into the browser loads the main site html, the same as omitting the json querystring variable: /
The JSON API is activated. I have tried reactivating and deactivating, checking .htaccess file settings, and deactivating all other plugins. None of those have made much difference so far.
For example, entering http://mywordpresswebsite.example/?json=1
into the browser loads the main site html, the same as omitting the json querystring variable: http://mywordpresswebsite.example/
The JSON API is activated. I have tried reactivating and deactivating, checking .htaccess file settings, and deactivating all other plugins. None of those have made much difference so far.
Share Improve this question asked Apr 21, 2017 at 15:49 n8barn8bar 2191 gold badge3 silver badges11 bronze badges 5 |3 Answers
Reset to default 1I'm likely doing it wrong, but when I form my requests for a Wordpress installation at http://www.example/
like this:
http://www.example/index.php?rest_route=/my/rest/route/here
I end up getting proper responses back.
I had a heck of a time figuring this out and ended up grokking a URL formatted like that in the HTML returned to me. I was expecting to make requests as http://www.example/wp_json/wp/v2/my/rest/route/here
, but I only got HTML responses.
I had the same problem and I solved it setting the permalink in the wordpress and also changing the .htaccess (see https://www.wpbeginner/wp-tutorials/how-to-fix-wordpress-posts-returning-404-error/) to make permalink work correctly.
Ok, so the new endpoint for Wordpress 4.7 is mywordpresswebsite.example/index.php/wp-json. It's part of Wordpress Core as of 4.7 and not a plugin anymore, there's nothing to be activated. Thank you, Mark Kaplun.
/wp-json
, have you tried it? – Mark Kaplun Commented Apr 21, 2017 at 16:26/index.php/wp-json
worked. Thank you!! – n8bar Commented Apr 21, 2017 at 16:34