2758 | | if ( 'ids' == $q['fields'] ) { |
2759 | | if ( null === $this->posts ) { |
2760 | | $this->posts = $wpdb->get_col( $this->request ); |
2761 | | } |
2762 | | |
2763 | | $this->posts = array_map( 'intval', $this->posts ); |
2764 | | $this->post_count = count( $this->posts ); |
2765 | | $this->set_found_posts( $q, $limits ); |
2766 | | |
2767 | | return $this->posts; |
2768 | | } |
2769 | | |
2770 | | if ( 'id=>parent' == $q['fields'] ) { |
2771 | | if ( null === $this->posts ) { |
2772 | | $this->posts = $wpdb->get_results( $this->request ); |
2773 | | } |
2774 | | |
2775 | | $this->post_count = count( $this->posts ); |
2776 | | $this->set_found_posts( $q, $limits ); |
2777 | | |
2778 | | $r = array(); |
2779 | | foreach ( $this->posts as $key => $post ) { |
2780 | | $this->posts[ $key ]->ID = (int) $post->ID; |
2781 | | $this->posts[ $key ]->post_parent = (int) $post->post_parent; |
2782 | | |
2783 | | $r[ (int) $post->ID ] = (int) $post->post_parent; |
2784 | | } |
2785 | | |
2786 | | return $r; |
2787 | | } |
2788 | | |
2792 | | /** |
2793 | | * Filters whether to split the query. |
2794 | | * |
2795 | | * Splitting the query will cause it to fetch just the IDs of the found posts |
2796 | | * (and then individually fetch each post by ID), rather than fetching every |
2797 | | * complete row at once. One massive result vs. many small results. |
2798 | | * |
2799 | | * @since 3.4.0 |
2800 | | * |
2801 | | * @param bool $split_the_query Whether or not to split the query. |
2802 | | * @param WP_Query $this The WP_Query instance. |
2803 | | */ |
2804 | | $split_the_query = apply_filters( 'split_the_query', $split_the_query, $this ); |
| 2761 | /** |
| 2762 | * Filters whether to split the query. |
| 2763 | * |
| 2764 | * Splitting the query will cause it to fetch just the IDs of the found posts |
| 2765 | * (and then individually fetch each post by ID), rather than fetching every |
| 2766 | * complete row at once. One massive result vs. many small results. |
| 2767 | * |
| 2768 | * @since 3.4.0 |
| 2769 | * |
| 2770 | * @param bool $split_the_query Whether or not to split the query. |
| 2771 | * @param WP_Query $this The WP_Query instance. |
| 2772 | */ |
| 2773 | $split_the_query = apply_filters( 'split_the_query', $split_the_query, $this ); |
| 2774 | } |
2842 | | /** |
2843 | | * Filters the raw post results array, prior to status checks. |
2844 | | * |
2845 | | * @since 2.3.0 |
2846 | | * |
2847 | | * @param array $posts The post results array. |
2848 | | * @param WP_Query &$this The WP_Query instance (passed by reference). |
2849 | | */ |
2850 | | $this->posts = apply_filters_ref_array( 'posts_results', array( $this->posts, &$this ) ); |
| 2818 | if ( 'ids' == $q['fields'] ) { |
| 2819 | /** |
| 2820 | * Filters the raw ids results array, prior to status checks. |
| 2821 | * |
| 2822 | * @since 4.9.0 |
| 2823 | * |
| 2824 | * @param array $posts The post ids results array. |
| 2825 | * @param WP_Query &$this The WP_Query instance (passed by reference). |
| 2826 | */ |
| 2827 | $this->posts = apply_filters_ref_array( 'posts_results_ids', array( $this->posts, &$this ) ); |
| 2828 | } else { |
| 2829 | /** |
| 2830 | * Filters the raw post results array, prior to status checks. |
| 2831 | * |
| 2832 | * @since 2.3.0 |
| 2833 | * |
| 2834 | * @param array $posts The post results array. |
| 2835 | * @param WP_Query &$this The WP_Query instance (passed by reference). |
| 2836 | */ |
| 2837 | $this->posts = apply_filters_ref_array( 'posts_results', array( $this->posts, &$this ) ); |
| 2838 | } |
| 2839 | } |
| 2840 | |
| 2841 | if ( 'ids' == $q['fields'] ) { |
| 2842 | $this->post_count = count( $this->posts ); |
| 2843 | return $this->posts; |