Skip to content

Commit 3839805

Browse files
Docs: Explicitly document the rest_revision_query filter.
The `rest_revision_query` filter in `WP_REST_Revisions_Controller::get_items()` carried a cross-reference comment claiming it was documented in the posts controller. This was incorrect, as the posts controller documents `rest_{$this->post_type}_query` — a dynamic hook that fires only for post types managed by `WP_REST_Posts_Controller`. `WP_REST_Revisions_Controller` extends `WP_REST_Controller` directly (not the posts controller), so the dynamic hook never fires for revisions. `rest_revision_query` is a standalone hook and has never had its own PHPDoc block. Follow-up to [43584]. Props apermo, mukesh27, SergeyBiryukov. See #64224. git-svn-id: https://develop.svn.wordpress.org/trunk@61998 602fd350-edb4-49c9-b593-d223f7449a82
1 parent e9b452a commit 3839805

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ protected function get_revision( $id ) {
226226
*
227227
* @since 4.7.0
228228
*
229+
* @see WP_REST_Posts_Controller::get_items()
230+
*
229231
* @param WP_REST_Request $request Full details about the request.
230232
* @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
231233
*/
@@ -297,7 +299,17 @@ public function get_items( $request ) {
297299
$args['update_post_meta_cache'] = false;
298300
}
299301

300-
/** This filter is documented in wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php */
302+
/**
303+
* Filters WP_Query arguments when querying revisions via the REST API.
304+
*
305+
* Serves the same purpose as the {@see 'rest_{$this->post_type}_query'} filter in
306+
* WP_REST_Posts_Controller, but for the standalone WP_REST_Revisions_Controller.
307+
*
308+
* @since 5.0.0
309+
*
310+
* @param array $args Array of arguments for WP_Query.
311+
* @param WP_REST_Request $request The REST API request.
312+
*/
301313
$args = apply_filters( 'rest_revision_query', $args, $request );
302314
if ( ! is_array( $args ) ) {
303315
$args = array();

0 commit comments

Comments
 (0)