Skip to content

Commit 9c0665c

Browse files
committed
Simplify admin comment query post type handling
Refactors the logic for handling admin comment queries by checking only for the presence of 'post_type' in query variables and setting the status to 'all', removing the previous conditional and redundant assignments.
1 parent bdbbc85 commit 9c0665c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

includes/class-comment.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -705,10 +705,8 @@ public static function comment_query( $query ) {
705705
// Handle admin comment queries.
706706
if ( \is_admin() ) {
707707
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
708-
if ( ( isset( $_GET['comment_status'] ) && 'federated' === $_GET['comment_status'] && empty( $query->query_vars['count'] ) ) || self::hide_for() === $query->query_vars['post_type'] ) {
709-
// Show only comments from hidden post types (Fediverse view).
710-
$query->query_vars['post_type'] = self::hide_for();
711-
$query->query_vars['status'] = 'all';
708+
if ( $query->query_vars['post_type'] ) {
709+
$query->query_vars['status'] = 'all';
712710
} else {
713711
// Exclude comments from hidden post types.
714712
$query->query_vars['post_type'] = array_diff( \get_post_types_by_support( 'comments' ), self::hide_for() );

0 commit comments

Comments
 (0)