Skip to content

Commit

Permalink
Merge pull request #400 from 10up/fix/399-undefined-property
Browse files Browse the repository at this point in the history
Prevent undefined property warnings during search.
  • Loading branch information
Sidsector9 authored Sep 26, 2024
2 parents fb74c57 + 52c4f33 commit f71b408
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions inc/classes/class-srm-post-type.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class SRM_Post_Type {
*
* @var string
*/
private $redirect_search_term;
private $redirect_search_term = false;

/**
* Sets up redirect manager
Expand Down Expand Up @@ -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';

Expand Down

0 comments on commit f71b408

Please sign in to comment.