WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #16894, comment 1


Ignore:
Timestamp:
03/19/2011 11:30:49 AM (9 years ago)
Author:
dd32
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #16894, comment 1

    initial v1  
    33
    44{{{
    5         add_filter('the_comments', 'cache_all_comment_meta', 100); // using get_comments()
    6         add_filter('comments_array', 'cache_all_comment_meta', 100); // using Direct SQL in comments_template()
    7         function cache_all_comment_meta($comments) {
    8                 $comment_ids = wp_list_pluck($comments, 'comment_ID');
    9                 update_meta_cache('comment', $comment_ids);
    10                 return $comments;
    11         }
     5add_filter('the_comments', 'cache_all_comment_meta', 100); // using get_comments()
     6add_filter('comments_array', 'cache_all_comment_meta', 100); // using Direct SQL in comments_template()
     7function cache_all_comment_meta($comments) {
     8        $comment_ids = wp_list_pluck($comments, 'comment_ID');
     9        update_meta_cache('comment', $comment_ids);
     10        return $comments;
     11}
    1212comments_template, apply_filters, call_user_func_array, cache_all_comment_meta, update_meta_cache #12 (0.7ms)
    1313SELECT comment_id, meta_key, meta_value FROM wp_commentmeta WHERE comment_id IN (4,5,6,7,34,35,36,37)