Valet: Unable to use WordPress REST API with Valet

Created on 19 Apr 2017  Â·  2Comments  Â·  Source: laravel/valet

I'm developing a plugin for Wordpress and I need to use WordPress REST api but they do not work. I have just tried the basic ones but the site returns the homepage.
Any idea about that?

Most helpful comment

I had this problem too, but the most common cause is that permalinks are not set.

I tried looking for this in the documentation but it is somewhat hidden in the handbook under Discovery

For sites without “pretty permalinks” enabled, /wp-json/ isn’t automatically handled by WordPress. This means that normal/default WordPress permalinks will be used instead. These headers look more like this:
Link: http://example.com/?rest_route=/; rel="https://api.w.org/"

All 2 comments

I had this problem too, but the most common cause is that permalinks are not set.

I tried looking for this in the documentation but it is somewhat hidden in the handbook under Discovery

For sites without “pretty permalinks” enabled, /wp-json/ isn’t automatically handled by WordPress. This means that normal/default WordPress permalinks will be used instead. These headers look more like this:
Link: http://example.com/?rest_route=/; rel="https://api.w.org/"

Thank you 👍

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ellisio picture ellisio  Â·  4Comments

LucidNinja picture LucidNinja  Â·  4Comments

eberkund picture eberkund  Â·  4Comments

webartistse picture webartistse  Â·  4Comments

dustinleblanc picture dustinleblanc  Â·  4Comments