Uses
Uses | Description |
---|---|
wp-includes/wp-db.php: wpdb::esc_like() | First half of escaping for LIKE special characters % and _ before preparing for MySQL. |
wp-includes/wp-db.php: wpdb::prepare() | Prepares a SQL query for safe execution. |
Used internally to generate an SQL string for searching across multiple columns
(string) (Required)
(array) (Required)
(string)
File: wp-includes/class-wp-comment-query.php
protected function get_search_sql( $string, $cols ) { global $wpdb; $like = '%' . $wpdb->esc_like( $string ) . '%'; $searches = array(); foreach ( $cols as $col ) { $searches[] = $wpdb->prepare( "$col LIKE %s", $like ); } return ' AND (' . implode( ' OR ', $searches ) . ')'; }
Version | Description |
---|---|
3.1.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_comment_query/get_search_sql