[wp-trac] [WordPress Trac] #57440: Add filter to customize the "rest_availability" test URL

WordPress Trac noreply at wordpress.org
Tue Jan 10 20:55:14 UTC 2023


#57440: Add filter to customize the "rest_availability" test URL
--------------------------------------+-----------------------------
 Reporter:  mcaskill                  |      Owner:  (none)
     Type:  enhancement               |     Status:  new
 Priority:  normal                    |  Milestone:  Awaiting Review
Component:  Site Health               |    Version:  5.2
 Severity:  normal                    |   Keywords:  has-patch
  Focuses:  administration, rest-api  |
--------------------------------------+-----------------------------
 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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57440>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list