Skip to content

Commit

Permalink
Skip search filtering when is_admin
Browse files Browse the repository at this point in the history
Don't run when in admin context.
  • Loading branch information
pkevan authored Feb 5, 2024
1 parent f44d128 commit 828162f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions source/wp-content/themes/wporg-developer-2023/inc/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,11 @@ public static function parse_search_order( $q ) {
public static function redirect_empty_search( $posts, $query ) {
$redirect = '';

// Skip when in admin context.
if ( is_admin() ) {
return $posts;
}

// If request is an empty search.
if ( $query->is_main_query() && $query->is_search() && ! trim( get_search_query() ) ) {
// If search is filtered.
Expand Down

0 comments on commit 828162f

Please sign in to comment.