Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: rest_query_var-{$key}

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
891                /**
892                 * Filters the query_vars used in get_items() for the constructed query.
893                 *
894                 * The dynamic portion of the hook name, `$key`, refers to the query_var key.
895                 *
896                 * @since 4.7.0
897                 *
898                 * @param string $value The query_var value.
899                 */
900                $query_args[ $key ] = apply_filters( "rest_query_var-{$key}", $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
901           }
902
903           if ( 'post' !== $this->post_type || ! isset( $query_args['ignore_sticky_posts'] ) ) {
904                $query_args['ignore_sticky_posts'] = true;
905           }
906
907           // Map to proper WP_Query orderby param.
908           if ( isset( $query_args['orderby'] ) && isset( $request['orderby'] ) ) {
909                $orderby_mappings = array(