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: <ul> <li>rest_post_query</li> <li>rest_page_query</li> <li>rest_attachment_query</li> </ul> Enables adding extra arguments or setting defaults for a post collection request.
438*439* @link https://developer.wordpress.org/reference/classes/wp_query/440*441* @param array$argsArray of arguments for WP_Query.442* @param WP_REST_Request$request The RESTAPI request.443*/444$args=apply_filters("rest_{$this->post_type}_query",$args,$request);445if(!is_array($args)){446$args=array();447}448$query_args=$this->prepare_items_query($args,$request);449450$posts_query=newWP_Query();
History
Introduced in 4.7.0. Unchanged from 6.7.7 through 7.1.0.