Summery Summery
Used internally to generate an SQL string for searching across multiple columns.
Syntax Syntax
Parameters Parameters
- $string
-
(Required) Search string.
- $columns
-
(Required) Array of columns to search.
Return Return
(string) Search SQL.
Source Source
File: wp-includes/class-wp-network-query.php
global $wpdb; $like = '%' . $wpdb->esc_like( $string ) . '%'; $searches = array(); foreach ( $columns as $column ) { $searches[] = $wpdb->prepare( "$column LIKE %s", $like ); } return '(' . implode( ' OR ', $searches ) . ')'; }
Advertisement
Changelog Changelog
Version | Description |
---|---|
4.6.0 | Introduced. |