[wp-trac] [WordPress Trac] #45933: WSODs protection returns incorrect content type

WordPress Trac noreply at wordpress.org
Sun Jan 13 12:36:35 UTC 2019


#45933: WSODs protection returns incorrect content type
----------------------------------+------------------------------
 Reporter:  spacedmonkey          |       Owner:  (none)
     Type:  defect (bug)          |      Status:  new
 Priority:  normal                |   Milestone:  Awaiting Review
Component:  Bootstrap/Load        |     Version:  trunk
 Severity:  normal                |  Resolution:
 Keywords:  servehappy has-patch  |     Focuses:  multisite
----------------------------------+------------------------------

Comment (by rmccue):

 Replying to [comment:7 spacedmonkey]:
 > The issue here is, that the `REST_REQUEST` is setup until
 `parse_request` filter, this is far late to help for this use case.

 WordPress doesn't know that it's a REST API request until WP's routing is
 done. There's no real way around this; it's simply too early before
 `parse_request` to tell what the request is.

 In the error handler, you could try detecting the `Accept` header, and
 external well-formed requests can send `Accept: application/json`.
 Otherwise, I don't think there's really a solution.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45933#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list