2

For example, entering http://mywordpresswebsite.example.com/?json=1 into the browser loads the main site html, the same as omitting the json querystring variable: http://mywordpresswebsite.example.com/

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.

  • 2
    what do you men "json api is activated". the api is part of version 4.7 and there is nothing that needs to be activated – Mark Kaplun Apr 21 '17 at 16:13
  • 1
    Touche Mark. But it still doesn't work when the old plugin is deactivated. – n8bar Apr 21 '17 at 16:19
  • 2
    the end point is in /wp-json, have you tried it? – Mark Kaplun Apr 21 '17 at 16:26
  • 1
    I didn't know that but it gave me a 404 error. however, /index.php/wp-json worked. Thank you!! – n8bar Apr 21 '17 at 16:34
  • 1
    if you need the /index.php there is probably something generaly wrong with how permalinks are setup on the site. never saw it myself so not sure what advice to give – Mark Kaplun Apr 21 '17 at 16:50
1

I'm likely doing it wrong, but when I form my requests for a Wordpress installation at http://www.example.com/ like this:

http://www.example.com/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.com/wp_json/wp/v2/my/rest/route/here , but I only got HTML responses.

1

I had the same problem and I solved it setting the permalink in the wordpress and also changing the .htaccess (see https://www.wpbeginner.com/wp-tutorials/how-to-fix-wordpress-posts-returning-404-error/) to make permalink work correctly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.