mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-13 06:07:23 +01:00
REST API: Move rest_pre_serve_request filter to after no cache headers are sent.
Merges [57012] to 6.4 branch. [56834] adjusted the order of activity inside the rest server responses. This lead to the rest_pre_serve_request filter potentially blocking the sending of the no cache headers. This moves that action back to being after the sending of no cache headers has finished to restore the pre 6.3.2 order of these two actions. Props perrelet, SergeyBiryukov, peterwilsoncc, hellofromTonya. Fixes #59722. Built from https://develop.svn.wordpress.org/branches/6.4@57014 git-svn-id: http://core.svn.wordpress.org/branches/6.4@56525 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2277da5029
commit
64bd43c885
@ -466,22 +466,6 @@ class WP_REST_Server {
|
||||
$code = $result->get_status();
|
||||
$this->set_status( $code );
|
||||
|
||||
/**
|
||||
* Filters whether the REST API request has already been served.
|
||||
*
|
||||
* Allow sending the request manually - by returning true, the API result
|
||||
* will not be sent to the client.
|
||||
*
|
||||
* @since 4.4.0
|
||||
*
|
||||
* @param bool $served Whether the request has already been served.
|
||||
* Default false.
|
||||
* @param WP_HTTP_Response $result Result to send to the client. Usually a `WP_REST_Response`.
|
||||
* @param WP_REST_Request $request Request used to generate the response.
|
||||
* @param WP_REST_Server $server Server instance.
|
||||
*/
|
||||
$served = apply_filters( 'rest_pre_serve_request', false, $result, $request, $this );
|
||||
|
||||
/**
|
||||
* Filters whether to send nocache headers on a REST API request.
|
||||
*
|
||||
@ -504,6 +488,22 @@ class WP_REST_Server {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters whether the REST API request has already been served.
|
||||
*
|
||||
* Allow sending the request manually - by returning true, the API result
|
||||
* will not be sent to the client.
|
||||
*
|
||||
* @since 4.4.0
|
||||
*
|
||||
* @param bool $served Whether the request has already been served.
|
||||
* Default false.
|
||||
* @param WP_HTTP_Response $result Result to send to the client. Usually a `WP_REST_Response`.
|
||||
* @param WP_REST_Request $request Request used to generate the response.
|
||||
* @param WP_REST_Server $server Server instance.
|
||||
*/
|
||||
$served = apply_filters( 'rest_pre_serve_request', false, $result, $request, $this );
|
||||
|
||||
if ( ! $served ) {
|
||||
if ( 'HEAD' === $request->get_method() ) {
|
||||
return null;
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.4-RC2-57010';
|
||||
$wp_version = '6.4-RC2-57014';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user