Make WordPress Core

Opened 17 months ago

#57440 new enhancement

Add filter to customize the "rest_availability" test URL

Reported by: mcaskill's profile mcaskill Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.2
Component: Site Health Keywords: has-patch
Focuses: administration, rest-api Cc:


The rest_availability test checks if the post post type is editable via the wp/v2/types/post endpoint.

If ever the post post type is excluded from the REST API, this test will fail:

  "code": "rest_cannot_read_type",
  "message": "Cannot view post type.",
  "data": {
    "status": 401
When testing the REST API, an unexpected result was returned:
REST API Endpoint: https://example.test/wp-json/wp/v2/types/post?context=edit
REST API Response: (403) Forbidden

This scenario occurs on sites that disable the post type.

Currently, this can be resolved either by replacing the test or filtering its results.

Ideally, I believe a filter to customize the REST URL to test would be the best option.

Attachments (1)

57440.diff (1.1 KB) - added by mcaskill 17 months ago.
Add filter "site_status_test_rest_availability_url" to get_test_rest_availability()

Download all attachments as: .zip

Change History (1)

17 months ago

Add filter "site_status_test_rest_availability_url" to get_test_rest_availability()

Note: See TracTickets for help on using tickets.