0

I have seen a number of posts addressing this (such as 404 on http://localhost/wp-json/wp/v2/posts in wordpress using REST API V2) but none of the suggestions have worked. I've tried

  • chmod'ing wp-content to 777
  • changing the permalinks to something other than 'plain' (and also changing them to plain and then back again)

I'm trying to access the JSON API from a localhost installation but keep getting a 404 error. Perhaps it's my URL?

I'm trying to access

http://localhost/wp/v2/posts

and I get 404

Someone suggested

/wp-json/wp/v2/

but that didn't work either.

http://localhost/wordpress pulls up the WP page just fine.

I am running this under MAMP Apache on MacOS. WP 5.1. Any help much appreciated!

1 Answer 1

0

The trick (in my case) was to include wordpress in the route. Thus

http://localhost/wordpress/wp-json/wp/v2/posts

works just fine

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.