mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 15:08:10 +01:00
Set a variable for like-escaped string before looping in WP_User_Query::get_search_sql()
.
Props miqrogroove. Fixes #10041. Built from https://develop.svn.wordpress.org/trunk@28722 git-svn-id: http://core.svn.wordpress.org/trunk@28536 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f8b03aa528
commit
6a61826660
@ -802,11 +802,14 @@ class WP_User_Query {
|
||||
$searches = array();
|
||||
$leading_wild = ( 'leading' == $wild || 'both' == $wild ) ? '%' : '';
|
||||
$trailing_wild = ( 'trailing' == $wild || 'both' == $wild ) ? '%' : '';
|
||||
$like = $leading_wild . $wpdb->esc_like( $string ) . $trailing_wild;
|
||||
|
||||
foreach ( $cols as $col ) {
|
||||
if ( 'ID' == $col )
|
||||
if ( 'ID' == $col ) {
|
||||
$searches[] = $wpdb->prepare( "$col = %s", $string );
|
||||
else
|
||||
$searches[] = $wpdb->prepare( "$col LIKE %s", $leading_wild . $wpdb->esc_like( $string ) . $trailing_wild );
|
||||
} else {
|
||||
$searches[] = $wpdb->prepare( "$col LIKE %s", $like );
|
||||
}
|
||||
}
|
||||
|
||||
return ' AND (' . implode(' OR ', $searches) . ')';
|
||||
|
Loading…
Reference in New Issue
Block a user