Changeset 49700
- Timestamp:
- 11/26/2020 05:02:02 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-query.php
r49693 r49700 77 77 78 78 /** 79 * Get postdatabase query.79 * SQL for the database query. 80 80 * 81 81 * @since 2.0.1 … … 85 85 86 86 /** 87 * List of posts.87 * Array of post objects or post IDs. 88 88 * 89 89 * @since 1.5.0 90 * @var array90 * @var WP_Post[]|int[] 91 91 */ 92 92 public $posts; … … 119 119 * The current post. 120 120 * 121 * This property does not get populated when the `fields` argument is set to 122 * `ids` or `id=>parent`. 123 * 121 124 * @since 1.5.0 122 * @var WP_Post 125 * @var WP_Post|null 123 126 */ 124 127 public $post; … … 128 131 * 129 132 * @since 2.2.0 130 * @var array133 * @var WP_Comment[] 131 134 */ 132 135 public $comments; … … 149 152 150 153 /** 151 * Current comment ID.154 * Current comment object. 152 155 * 153 156 * @since 2.2.0 154 * @var int157 * @var WP_Comment 155 158 */ 156 159 public $comment; … … 2661 2664 $comments = (array) $wpdb->get_results( "SELECT $distinct {$wpdb->comments}.* FROM {$wpdb->comments} $cjoin $cwhere $cgroupby $corderby $climits" ); 2662 2665 // Convert to WP_Comment. 2666 /** @var WP_Comment[] */ 2663 2667 $this->comments = array_map( 'get_comment', $comments ); 2664 2668 $this->comment_count = count( $this->comments ); … … 2945 2949 * @since 4.6.0 2946 2950 * 2947 * @param array|null $posts Return an array of post data to short-circuit WP's query,2948 * or null to allow WP to run its normal queries.2949 * @param WP_Query $this The WP_Query instance (passed by reference).2951 * @param WP_Post[]|int[]|null $posts Return an array of post data to short-circuit WP's query, 2952 * or null to allow WP to run its normal queries. 2953 * @param WP_Query $this The WP_Query instance (passed by reference). 2950 2954 */ 2951 2955 $this->posts = apply_filters_ref_array( 'posts_pre_query', array( null, &$this ) ); … … 2956 2960 } 2957 2961 2962 /** @var int[] */ 2958 2963 $this->posts = array_map( 'intval', $this->posts ); 2959 2964 $this->post_count = count( $this->posts ); … … 2971 2976 $this->set_found_posts( $q, $limits ); 2972 2977 2978 /** @var int[] */ 2973 2979 $r = array(); 2974 2980 foreach ( $this->posts as $key => $post ) { … … 3031 3037 // Convert to WP_Post objects. 3032 3038 if ( $this->posts ) { 3039 /** @var WP_Post[] */ 3033 3040 $this->posts = array_map( 'get_post', $this->posts ); 3034 3041 } … … 3067 3074 $comments = $wpdb->get_results( $comments_request ); 3068 3075 // Convert to WP_Comment. 3076 /** @var WP_Comment[] */ 3069 3077 $this->comments = array_map( 'get_comment', $comments ); 3070 3078 $this->comment_count = count( $this->comments ); … … 3196 3204 $this->post_count = count( $this->posts ); 3197 3205 3206 /** @var WP_Post[] */ 3198 3207 $this->posts = array_map( 'get_post', $this->posts ); 3199 3208 … … 3202 3211 } 3203 3212 3213 /** @var WP_Post */ 3204 3214 $this->post = reset( $this->posts ); 3205 3215 } else { … … 3282 3292 $this->current_post++; 3283 3293 3294 /** @var WP_Post */ 3284 3295 $this->post = $this->posts[ $this->current_post ]; 3285 3296 return $this->post; … … 3375 3386 $this->current_comment++; 3376 3387 3388 /** @var WP_Comment */ 3377 3389 $this->comment = $this->comments[ $this->current_comment ]; 3378 3390 return $this->comment;
Note: See TracChangeset
for help on using the changeset viewer.