Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#50478 closed defect (bug) (invalid)

"Plain" Permalink Settings makes WP API unreachable

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

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
5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to 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.