Skip to content

Docs: add PHPDoc for rest_revision_query filter#11201

Open
apermo wants to merge 1 commit intoWordPress:trunkfrom
apermo:fix/rest-revision-query-phpdoc
Open

Docs: add PHPDoc for rest_revision_query filter#11201
apermo wants to merge 1 commit intoWordPress:trunkfrom
apermo:fix/rest-revision-query-phpdoc

Conversation

@apermo
Copy link

@apermo apermo commented Mar 8, 2026

Summary

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 filter is documented in wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php */
$args = apply_filters( 'rest_revision_query', $args, $request );

That cross-reference is incorrect. 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.

Deeper context apermo#9

Changes

  • Replace the broken cross-reference comment with a proper @since 4.7.0 PHPDoc block for rest_revision_query
  • Add @see WP_REST_Posts_Controller::get_items() to the get_items() method docblock to surface the parallel relationship between the two controllers, following the same {@see} pattern used in comment.php and post.php for related hooks

Trac ticket: https://core.trac.wordpress.org/ticket/64224

Use of AI Tools

Research (architectural investigation, prior-art search across core) and code were produced by Claude Code (claude-sonnet-4-6). The contributor reviewed the findings, steered the documentation approach, and approved the final implementation.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

Replace the incorrect "documented in posts-controller"
cross-reference with a proper @SInCE 4.7.0 PHPDoc block.
Add @see WP_REST_Posts_Controller::get_items() to the
method docblock to surface the parallel relationship.

Related to https://core.trac.wordpress.org/ticket/64224
@github-actions
Copy link

github-actions bot commented Mar 8, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props apermo.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions
Copy link

github-actions bot commented Mar 8, 2026

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

* @since 4.7.0
*
* @param array $args Array of arguments for WP_Query.
* @param WP_REST_Request $request The REST API request.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param WP_REST_Request $request The REST API request.
* @param WP_REST_Request $request Request used to generate the response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants