WordPress at a glance
function is not described

WP_Comment_Query::get_search_sql() protected WP 3.1.0

Used internally to generate an SQL string for searching across multiple columns

{} It's a method of the class: WP_Comment_Query{}

No Hooks.

Return

String. Null. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_search_sql( $string, $cols );
$string(string) (required)
-
$cols(array) (required)
-

Notes

  • Global. wpdb. $wpdb WordPress database abstraction object.

Changelog

Since 3.1.0 Introduced.

Code of WP_Comment_Query::get_search_sql() WP 5.7

<?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 ) . ')';
}