Skip to content

Commit

Permalink
Merge pull request #477 from pfefferle/improve/performance
Browse files Browse the repository at this point in the history
Speeds up the loading of posts with lots of comments
  • Loading branch information
dshanske authored Jul 5, 2024
2 parents 9e6764d + c46cd0a commit 7ab2218
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 7ab2218

Please sign in to comment.