| @@ -62,9 +62,10 @@ | ||
| 62 | 62 | 'posts_per_page' => (int) $settings['max_shown'], |
| 63 | 63 | 'ignore_sticky_posts' => true, |
| 64 | 64 | 'no_found_rows' => true, |
| 65 | 65 | 'update_post_term_cache' => false, |
| 66 | - 'update_post_meta_cache' => false | |
| 66 | + // The loop reads each reply's topic/author meta; load it in one query. | |
| 67 | + 'update_post_meta_cache' => true | |
| 67 | 68 | )); |
| 68 | 69 | |
| 69 | 70 | // Bail if no replies are found |
| 70 | 71 | if (!$widget_query->have_posts()) { |
| @@ -69,8 +70,11 @@ | ||
| 69 | 70 | // Bail if no replies are found |
| 70 | 71 | if (!$widget_query->have_posts()) { |
| 71 | 72 | return; |
| 72 | 73 | } |
| 74 | + | |
| 75 | + // Parent topics are used for titles and links; fetch them together. | |
| 76 | + _prime_post_caches(array_unique(wp_list_pluck($widget_query->posts, 'post_parent')), false, true); | |
| 73 | 77 | |
| 74 | 78 | echo $args['before_widget']; |
| 75 | 79 | |
| 76 | 80 | if (!empty($settings['title'])) { |