Fix bug when searching orders with a term starting with d, s, or f (#43085)

* Don't prepare the order search $meta_sub_query twice.

Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Nestor Soriano <konamiman@konamiman.com>
This commit is contained in:
Michael Pretty 2024-01-03 05:49:17 -05:00 committed by GitHub
parent 187780905f
commit e7647333a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Fix bug when searching orders with a term starting with d, s, or f.

View File

@ -91,12 +91,9 @@ class OrdersTableSearchQuery {
$meta_sub_query = $this->generate_where_for_meta_table(); $meta_sub_query = $this->generate_where_for_meta_table();
$where .= $wpdb->prepare( $where .= $wpdb->prepare(
" 'search_query_items.order_item_name LIKE %s',
search_query_items.order_item_name LIKE %s
OR `$order_table`.id IN ( $meta_sub_query )
",
'%' . $wpdb->esc_like( $this->search_term ) . '%' '%' . $wpdb->esc_like( $this->search_term ) . '%'
); ) . " OR `$order_table`.id IN ( $meta_sub_query ) ";
return " ( $where ) "; return " ( $where ) ";
} }