diff --git a/wp-includes/class-wp-object-query.php b/wp-includes/class-wp-object-query.php index 5d4dd025a..67524bb00 100644 --- a/wp-includes/class-wp-object-query.php +++ b/wp-includes/class-wp-object-query.php @@ -70,32 +70,6 @@ class WP_Object_Query { $qv['meta_query'] = $meta_query; } - - /* - * Used internally to generate an SQL string for searching across multiple columns - * - * @access protected - * @since 3.1.0 - * - * @param string $string - * @param array $cols - * @param bool $wild Whether to allow trailing wildcard searches. Default is false. - * @return string - */ - function get_search_sql( $string, $cols, $wild = false ) { - $string = esc_sql( $string ); - - $searches = array(); - $wild_char = ( $wild ) ? '%' : ''; - foreach ( $cols as $col ) { - if ( 'ID' == $col ) - $searches[] = "$col = '$string'"; - else - $searches[] = "$col LIKE '$string$wild_char'"; - } - - return ' AND (' . implode(' OR ', $searches) . ')'; - } } ?> diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 071a3faf8..3980ab1e9 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -341,6 +341,26 @@ class WP_Comment_Query extends WP_Object_Query { return $comments; } + + /* + * Used internally to generate an SQL string for searching across multiple columns + * + * @access protected + * @since 3.1.0 + * + * @param string $string + * @param array $cols + * @return string + */ + function get_search_sql( $string, $cols ) { + $string = esc_sql( $string ); + + $searches = array(); + foreach ( $cols as $col ) + $searches[] = "$col LIKE '%$string%'"; + + return ' AND (' . implode(' OR ', $searches) . ')'; + } } /** diff --git a/wp-includes/user.php b/wp-includes/user.php index fc6913ba4..22bc85b08 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -526,6 +526,32 @@ class WP_User_Query extends WP_Object_Query { } } + /* + * Used internally to generate an SQL string for searching across multiple columns + * + * @access protected + * @since 3.1.0 + * + * @param string $string + * @param array $cols + * @param bool $wild Whether to allow trailing wildcard searches. Default is false. + * @return string + */ + function get_search_sql( $string, $cols, $wild = false ) { + $string = esc_sql( $string ); + + $searches = array(); + $wild_char = ( $wild ) ? '%' : ''; + foreach ( $cols as $col ) { + if ( 'ID' == $col ) + $searches[] = "$col = '$string'"; + else + $searches[] = "$col LIKE '$string$wild_char'"; + } + + return ' AND (' . implode(' OR ', $searches) . ')'; + } + /** * Return the list of users *