Ticket #16894: 16894.2.diff
File 16894.2.diff, 1.6 KB (added by , 9 years ago) |
---|
-
src/wp-includes/comment-functions.php
451 451 * is true. 452 452 */ 453 453 function get_comment_meta($comment_id, $key = '', $single = false) { 454 global $in_comment_loop; 455 456 if ( $in_comment_loop ) { 457 update_comment_meta_cache(); 458 } 459 454 460 return get_metadata('comment', $comment_id, $key, $single); 455 461 } 456 462 457 463 /** 464 * Update cache for comment meta in the current comment loop 465 * 466 * @since 4.4.0 467 * 468 * @param object $wp_query Optional. A WP_Query instance. Defaults to the $wp_query global. 469 */ 470 function update_comment_meta_cache( $wp_query = null ) { 471 if ( ! $wp_query ) { 472 $wp_query = $GLOBALS['wp_query']; 473 } 474 475 if ( $wp_query->comment_meta_cached ) { 476 return; 477 } 478 479 $comment_ids = wp_list_pluck( $wp_query->comments, 'comment_ID' ); 480 481 update_meta_cache( 'comment', $comment_ids ); 482 483 $wp_query->comment_meta_cached = true; 484 } 485 486 /** 458 487 * Update comment meta field based on comment ID. 459 488 * 460 489 * Use the $prev_value parameter to differentiate between meta fields with the -
src/wp-includes/query.php
1293 1293 public $thumbnails_cached = false; 1294 1294 1295 1295 /** 1296 * Set if comment meta has already been cached 1297 * 1298 * @since 4.4.0 1299 * @access public 1300 * @var bool 1301 */ 1302 public $comment_meta_cached = false; 1303 1304 /** 1296 1305 * Cached list of search stopwords. 1297 1306 * 1298 1307 * @since 3.7.0