Changeset 16170 for trunk/wp-includes/class-wp-object-query.php
- Timestamp:
- 11/03/2010 07:31:11 PM (15 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/class-wp-object-query.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-wp-object-query.php
r16168 r16170 228 228 * @param string $string 229 229 * @param array $cols 230 * @param bool $wild Whether to allow trailing wildcard searches. Default is false. 230 231 * @return string 231 232 */ 232 function get_search_sql( $string, $cols ) {233 function get_search_sql( $string, $cols, $wild = false ) { 233 234 $string = esc_sql( $string ); 234 235 235 236 $searches = array(); 237 $wild_char = ( $wild ) ? '%' : ''; 236 238 foreach ( $cols as $col ) { 237 239 if ( 'ID' == $col ) 238 240 $searches[] = "$col = '$string'"; 239 241 else 240 $searches[] = "$col LIKE '$string %'";242 $searches[] = "$col LIKE '$string$wild_char'"; 241 243 } 242 244
Note: See TracChangeset
for help on using the changeset viewer.