Ticket #35476: 35476.2.diff
| File 35476.2.diff, 1.5 KB (added by , 10 years ago) |
|---|
-
src/wp-includes/query.php
3531 3531 } 3532 3532 3533 3533 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 3534 3554 $this->posts = $wpdb->get_col( $this->request ); 3535 3555 $this->posts = array_map( 'intval', $this->posts ); 3536 3556 $this->post_count = count( $this->posts ); … … 3540 3560 } 3541 3561 3542 3562 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 3543 3571 $this->posts = $wpdb->get_results( $this->request ); 3544 3572 $this->post_count = count( $this->posts ); 3545 3573 $this->set_found_posts( $q, $limits );