Skip to content

Commit ff81f88

Browse files
committed
Refine WP_Query search logic by adjusting $like variable handling
1 parent 714d744 commit ff81f88

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/wp-includes/class-wp-query.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,13 +1512,11 @@ protected function parse_search( &$query_vars ) {
15121512
$andor_op = 'OR';
15131513
}
15141514

1515+
$like = $start . $wpdb->esc_like( $term ) . $end;
15151516
if ( $end && ! $exclude ) {
1516-
$like = '%' . $wpdb->esc_like( $term ) . '%';
15171517
$query_vars['search_orderby_title'][] = $wpdb->prepare( "{$wpdb->posts}.post_title LIKE %s", $like );
15181518
}
15191519

1520-
$like = $start . $wpdb->esc_like( $term ) . $end;
1521-
15221520
$search_columns_parts = array();
15231521
foreach ( $search_columns as $search_column ) {
15241522
$search_columns_parts[ $search_column ] = $wpdb->prepare( "({$wpdb->posts}.$search_column $like_op %s)", $like );

0 commit comments

Comments
 (0)