apply_filters( "rest_{$this->post_type}_query", array $args , WP_REST_Request $request )
Filters WP_Query arguments when querying posts via the REST API.
Description
The dynamic portion of the hook name, $this->post_type
, refers to the post type slug.
Possible hook names include:
rest_post_query
rest_page_query
rest_attachment_query
Enables adding extra arguments or setting defaults for a post collection request.
Parameters
- $args
-
Array of arguments for WP_Query.
- $request
-
The REST API request.
Source
File: wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
Changelog
Version | Description |
---|---|
5.7.0 | Moved after the tax_query query arg is generated. |
4.7.0 | Introduced. |