diff --git src/wp-includes/comment-functions.php src/wp-includes/comment-functions.php
index 08ddfd2..6a2d652 100644
|
|
function update_comment_cache($comments) { |
2365 | 2365 | wp_cache_add($comment->comment_ID, $comment, 'comment'); |
2366 | 2366 | } |
2367 | 2367 | |
| 2368 | /** |
| 2369 | * Lazy load comment meta when inside of a `WP_Query` loop. |
| 2370 | * |
| 2371 | * @since 4.4.0 |
| 2372 | * |
| 2373 | * @param null $check The `$check` param passed from the 'pre_comment_metadata' hook. |
| 2374 | * @param int $comment_id ID of the comment whose metadata is being cached. |
| 2375 | * @return null In order not to short-circuit `get_metadata()`. |
| 2376 | */ |
| 2377 | function wp_lazyload_comment_meta( $check, $comment_id ) { |
| 2378 | global $wp_query; |
| 2379 | |
| 2380 | if ( ! empty( $wp_query->comments ) ) { |
| 2381 | // Don't use `wp_list_pluck()` to avoid by-reference manipulation. |
| 2382 | $comment_ids = array(); |
| 2383 | foreach ( $wp_query->comments as $comment ) { |
| 2384 | $comment_ids[] = $comment->comment_ID; |
| 2385 | } |
| 2386 | update_meta_cache( 'comment', $comment_ids ); |
| 2387 | } |
| 2388 | |
| 2389 | return $check; |
| 2390 | } |
| 2391 | |
2368 | 2392 | // |
2369 | 2393 | // Internal |
2370 | 2394 | // |
diff --git src/wp-includes/default-filters.php src/wp-includes/default-filters.php
index f9fd9c4..e9ddc47 100644
|
|
add_filter( 'nav_menu_meta_box_object', '_wp_nav_menu_meta_box_object' ); |
200 | 200 | add_filter( 'pingback_ping_source_uri', 'pingback_ping_source_uri' ); |
201 | 201 | add_filter( 'xmlrpc_pingback_error', 'xmlrpc_pingback_error' ); |
202 | 202 | add_filter( 'title_save_pre', 'trim' ); |
| 203 | add_filter( 'get_comment_metadata', 'wp_lazyload_comment_meta', 10, 2 ); |
203 | 204 | |
204 | 205 | add_filter( 'http_request_host_is_external', 'allowed_http_request_hosts', 10, 2 ); |
205 | 206 | |