Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #42061, comment 26


Ignore:
Timestamp:
10/18/2023 05:21:28 PM (19 months ago)
Author:
flixos90
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #42061, comment 26

    initial v1  
    11Reviving this ticket, as the lack of this function also prevents proper testing to discover bugs like that fixed in https://github.com/WordPress/wordpress-develop/pull/5514.
    22
    3 @TimothyBlynJacobs I wonder whether we should circle back here. I'm not sure we really need to go down the rewrite rules rabbit hole. What about simply having a function that applies a filter instead of being forced to check `defined( 'REST_REQUEST' ) && REST_REQUEST`? It would make code paths testable that were previously not testable. The filter could be used to set the value temporarily to `true` for preloaded REST requests (i.e. those where REST routes are called without actually triggering a REST request).
     3@TimothyBlynJacobs I wonder whether we should take a step back here. I'm not sure we really need to go down the rewrite rules rabbit hole. What about simply having a function that applies a filter instead of being forced to check `defined( 'REST_REQUEST' ) && REST_REQUEST`? It would make code paths testable that were previously not testable. The filter could be used to set the value temporarily to `true` for preloaded REST requests (i.e. those where REST routes are called without actually triggering a REST request).
    44
    55To some degree, that would achieve a different goal, and we could consider reflecting that in the function's and filter's name accordingly. But I think it's worth considering that approach, as it would be much simpler and would bring immediate benefits to testability of core.