Make WordPress Core

Ticket #38629: 38629.3.diff

File 38629.3.diff, 1.6 KB (added by jnylen0, 8 years ago)

Remove rest_query_var-{$key} filter

  • src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
    index 716f329..04d7779 100644
    a b class WP_REST_Posts_Controller extends WP_REST_Controller { 
    810810         * @since 4.7.0
    811811         * @access protected
    812812         *
    813          * @param array           $prepared_args Optional. Prepared WP_Query arguments. Default empty array.
    814          * @param WP_REST_Request $request       Optional. Full details about the request.
     813         * @param array           $query_args Optional. Prepared WP_Query arguments. Default empty array.
     814         * @param WP_REST_Request $request    Optional. Full details about the request.
    815815         * @return array Items query arguments.
    816816         */
    817         protected function prepare_items_query( $prepared_args = array(), $request = null ) {
    818                 $query_args = array();
    819 
    820                 foreach ( $prepared_args as $key => $value ) {
    821                         /**
    822                          * Filters the query_vars used in get_items() for the constructed query.
    823                          *
    824                          * The dynamic portion of the hook name, `$key`, refers to the query_var key.
    825                          *
    826                          * @since 4.7.0
    827                          *
    828                          * @param string $value The query_var value.
    829                          */
    830                         $query_args[ $key ] = apply_filters( "rest_query_var-{$key}", $value );
    831                 }
    832 
     817        protected function prepare_items_query( $query_args = array(), $request = null ) {
    833818                if ( 'post' !== $this->post_type || ! isset( $query_args['ignore_sticky_posts'] ) ) {
    834819                        $query_args['ignore_sticky_posts'] = true;
    835820                }