From 52c4f337fa5bcd8ac076cdc5954cac3503cfe942 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Thu, 26 Sep 2024 12:02:45 +1000 Subject: [PATCH] Restore search term to false to avoid undefined property warnings. --- inc/classes/class-srm-post-type.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/inc/classes/class-srm-post-type.php b/inc/classes/class-srm-post-type.php index 36eeb503..2ec6b4b8 100644 --- a/inc/classes/class-srm-post-type.php +++ b/inc/classes/class-srm-post-type.php @@ -22,7 +22,7 @@ class SRM_Post_Type { * * @var string */ - private $redirect_search_term; + private $redirect_search_term = false; /** * Sets up redirect manager @@ -144,7 +144,8 @@ public function filter_search_clauses( $clauses, $query ) { $search_term_like = '%' . $wpdb->esc_like( $search_term ) . '%'; $query->set( 's', $this->redirect_search_term ); - unset( $this->redirect_search_term ); + // Restore search term to a false value to prevent modifying the query again. + $this->redirect_search_term = false; $clauses['distinct'] = 'DISTINCT';