Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: rest_{$this->post_type}_query

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
258            * Enables adding extra arguments or setting defaults for a post collection request.
259            *
260            * @since 4.7.0
261            *
262            * @link https://developer.wordpress.org/reference/classes/wp_query/
263            *
264            * @param array           $args    Key value array of query var to query value.
265            * @param WP_REST_Request $request The request used.
266            */
267           $args = apply_filters( "rest_{$this->post_type}_query", $args, $request );
268           $query_args = $this->prepare_items_query( $args, $request );
269
270           $taxonomies = wp_list_filter( get_object_taxonomies( $this->post_type, 'objects' ), array( 'show_in_rest' => true ) );
271
272           foreach ( $taxonomies as $taxonomy ) {
273                $base = ! empty( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name;
274                $tax_exclude = $base . '_exclude';
275
276                if ( ! empty( $request[ $base ] ) ) {