Make WordPress Core

Ticket #35476: 35476.2.diff

File 35476.2.diff, 1.5 KB (added by adamsilverstein, 10 years ago)
  • src/wp-includes/query.php

     
    35313531                }
    35323532
    35333533                if ( 'ids' == $q['fields'] ) {
     3534
     3535                        /**
     3536                         * Filter the query results when 'fields' specified in a query.
     3537                         *
     3538                         * Plugins can bypass a 'fields' query by returning
     3539                         * an array of posts to be returned from the query.
     3540                         *
     3541                         * @since 4.5.0
     3542                         *
     3543                         * @param array    $posts   The filtered array of posts.
     3544                         * @param array    $request The complete SQL query.
     3545                         * @param string   $fields  The query 'fields' value.
     3546                         * @param WP_Query &$this   The WP_Query instance (passed by reference).
     3547                         */
     3548                        $this->posts = apply_filters_ref_array( 'fields_the_posts', array( false, $q['fields'], $this->request, &$this ) );
     3549
     3550                        if ( false !== $this->posts ) {
     3551                                return $this->posts;
     3552                        }
     3553
    35343554                        $this->posts = $wpdb->get_col( $this->request );
    35353555                        $this->posts = array_map( 'intval', $this->posts );
    35363556                        $this->post_count = count( $this->posts );
     
    35403560                }
    35413561
    35423562                if ( 'id=>parent' == $q['fields'] ) {
     3563
     3564                        /** This filter is documented in wp-includes/query.php */
     3565                        $this->posts = apply_filters_ref_array( 'fields_the_posts', array( false, $q['fields'], $this->request, &$this ) );
     3566
     3567                        if ( false !== $this->posts ) {
     3568                                return $this->posts;
     3569                        }
     3570
    35433571                        $this->posts = $wpdb->get_results( $this->request );
    35443572                        $this->post_count = count( $this->posts );
    35453573                        $this->set_found_posts( $q, $limits );