Skip to content

Commit

Permalink
Speeds up the loading of posts with lots of comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pfefferle committed Jun 7, 2024
1 parent 607cf28 commit c46cd0a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
12 changes: 2 additions & 10 deletions includes/class-comment-walker.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,22 +288,14 @@ public static function comment_query( $query ) {
return;
}

if ( is_admin() ) {
if ( is_admin() || ! is_singular() ) {
return;
}

if ( ! is_singular() ) {
if ( ! empty( $query->query_vars['type__in'] ) ) {
return;
}

if ( ! empty( $query->query_vars['meta_query'] ) ) {
$query_vars = current( $query->query_vars['meta_query'] );

if ( ! empty( $query_vars['key'] ) && 'protocol' === $query_vars['key'] ) {
return;
}
}

if ( isset( $query->query_vars['count'] ) && true === $query->query_vars['count'] ) {
return;
}
Expand Down
6 changes: 0 additions & 6 deletions templates/webmention-comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
array(
'post_id' => get_the_ID(),
'type__in' => get_webmention_comment_type_names(),
'meta_query' => array(
array(
'key' => 'protocol',
'compare' => 'EXISTS',
),
),
'status' => 'approve',
)
);
Expand Down

0 comments on commit c46cd0a

Please sign in to comment.