ActionScheduler_Abstract_ListTable::get_items_query_search()protectedWC 1.0

Check if the current request is doing a "full text" search. If that is the case prepares the SQL to search texts using LIKE.

If the current request does not have any search or if this list table does not support that feature it will return an empty string.

Method of the class: ActionScheduler_Abstract_ListTable{}

No Hooks.

Return

String.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_items_query_search();

ActionScheduler_Abstract_ListTable::get_items_query_search() code WC 8.6.1

protected function get_items_query_search() {
	global $wpdb;

	if ( empty( $_GET['s'] ) || empty( $this->search_by ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended
		return '';
	}

	$search_string = sanitize_text_field( wp_unslash( $_GET['s'] ) ); //phpcs:ignore WordPress.Security.NonceVerification.Recommended

	$filter = array();
	foreach ( $this->search_by as $column ) {
		$wild     = '%';
		$sql_like = $wild . $wpdb->esc_like( $search_string ) . $wild;
		$filter[] = $wpdb->prepare( '`' . $column . '` LIKE %s', $sql_like ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.DB.PreparedSQL.NotPrepared
	}
	return implode( ' OR ', $filter );
}