Docs: Add missing documentation for WP_*_Query::get_search_sql() method parameters.
Includes renaming the `$cols` parameter to `$columns` for consistency across the classes. Follow-up to [42876], [53272-53276]. See #54729. Built from https://develop.svn.wordpress.org/trunk@53280 git-svn-id: http://core.svn.wordpress.org/trunk@52869 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -1126,24 +1126,24 @@ class WP_Comment_Query {
|
||||
}
|
||||
|
||||
/**
|
||||
* Used internally to generate an SQL string for searching across multiple columns
|
||||
* Used internally to generate an SQL string for searching across multiple columns.
|
||||
*
|
||||
* @since 3.1.0
|
||||
*
|
||||
* @global wpdb $wpdb WordPress database abstraction object.
|
||||
*
|
||||
* @param string $search
|
||||
* @param array $cols
|
||||
* @return string
|
||||
* @param string $search Search string.
|
||||
* @param string[] $columns Array of columns to search.
|
||||
* @return string Search SQL.
|
||||
*/
|
||||
protected function get_search_sql( $search, $cols ) {
|
||||
protected function get_search_sql( $search, $columns ) {
|
||||
global $wpdb;
|
||||
|
||||
$like = '%' . $wpdb->esc_like( $search ) . '%';
|
||||
|
||||
$searches = array();
|
||||
foreach ( $cols as $col ) {
|
||||
$searches[] = $wpdb->prepare( "$col LIKE %s", $like );
|
||||
foreach ( $columns as $column ) {
|
||||
$searches[] = $wpdb->prepare( "$column LIKE %s", $like );
|
||||
}
|
||||
|
||||
return ' AND (' . implode( ' OR ', $searches ) . ')';
|
||||
|
||||
Reference in New Issue
Block a user