Changeset 34270 for trunk/src/wp-includes/comment-functions.php
- Timestamp:
- 09/17/2015 08:00:31 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/comment-functions.php
r34268 r34270 2377 2377 } 2378 2378 2379 /** 2380 * Lazy load comment meta when inside of a `WP_Query` loop. 2381 * 2382 * @since 4.4.0 2383 * 2384 * @param null $check The `$check` param passed from the 'pre_comment_metadata' hook. 2385 * @param int $comment_id ID of the comment whose metadata is being cached. 2386 * @return null In order not to short-circuit `get_metadata()`. 2387 */ 2388 function wp_lazyload_comment_meta( $check, $comment_id ) { 2389 global $wp_query; 2390 2391 if ( ! empty( $wp_query->comments ) ) { 2392 // Don't use `wp_list_pluck()` to avoid by-reference manipulation. 2393 $comment_ids = array(); 2394 foreach ( $wp_query->comments as $comment ) { 2395 $comment_ids[] = $comment->comment_ID; 2396 } 2397 update_meta_cache( 'comment', $comment_ids ); 2398 } 2399 2400 return $check; 2401 } 2402 2379 2403 // 2380 2404 // Internal
Note: See TracChangeset
for help on using the changeset viewer.