WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 5 months ago

#39889 new defect (bug)

Improve/Fix REST Response on Multisite when an endpoint for a non-existent site is hit.

Reported by: nerrad Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 4.7
Component: REST API Keywords: needs-patch needs-unit-tests
Focuses: multisite, rest-api Cc:
PR Number:

Description

Currently if you hit the endpoint for a domain on a site that doesn't exist it will behave the same as on a normal request.

Granted this is kind of edgecase, but I think it'd be better to handle things a bit better on REST requests. The question is how? I think from the standpoint of the REST client it'd be better to just return a 404 and a "site doesnt' exist" message (or something to that affect).

Change History (3)

#1 @jnylen0
3 years ago

  • Keywords needs-patch needs-unit-tests added
  • Milestone changed from Awaiting Review to Future Release

I am +1 on fixing this - the REST API should return a JSON 404 in the same style as the rest of our WP_Error responses.

The question is how. May be tricky depending on how early the current 404 is returned.

This ticket was mentioned in Slack in #core-restapi by timothybjacobs. View the logs.


5 months ago

#3 @TimothyBlynJacobs
5 months ago

It seems like we might be able to utilize wp_is_json_request and the wp_die improvements to make this simpler to handle.

I think this occurs in ms_load_current_site_and_network()?

Note: See TracTickets for help on using tickets.