Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#50478 closed defect (bug) (invalid)

"Plain" Permalink Settings makes WP API unreachable

Reported by: fitmealat Owned by:
Priority: normal Milestone:
Component: REST API Version: 5.4
Severity: normal Keywords:
Cc: Focuses:

Description

GET
​http://yourwpsite/wp-json
gets data from WP as expected

change permalink to "plain" in Settings->Permalinks
try again
​http://yourwpsite/wp-json
WP API unreachable

once you change permalink back to other format than Plain API is reachable again.

Change History (1)

#1 @swissspidy
6 years ago

  • Milestone Awaiting Review
  • Resolution → invalid
  • Status new → closed

Hi there

"Plain permalinks" means all URL rewrites and pretty permalinks will be disabled, either because the user chose that option or the server does not support pretty perrmalinks.

In these cases, https://example.com/wp-json/wp/v2/ would become https://example.com/?rest_route=/wp/v2

If you are developing a plugin, use the get_rest_url() function which automatically handles both cases and will give you a correct URL.

Note: See TracTickets for help on using tickets.