From 828162f821f9295b378b1780fbaf7c13b8ae31c6 Mon Sep 17 00:00:00 2001 From: Paul Kevan <2290623+pkevan@users.noreply.github.com> Date: Mon, 5 Feb 2024 16:19:00 +0000 Subject: [PATCH] Skip search filtering when is_admin Don't run when in admin context. --- source/wp-content/themes/wporg-developer-2023/inc/search.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/wp-content/themes/wporg-developer-2023/inc/search.php b/source/wp-content/themes/wporg-developer-2023/inc/search.php index 57358680b..51bcc1d0d 100644 --- a/source/wp-content/themes/wporg-developer-2023/inc/search.php +++ b/source/wp-content/themes/wporg-developer-2023/inc/search.php @@ -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.