WP_Query::is_search()publicWP 3.1.0

Is the query for a search?

Method of the class: WP_Query{}

No Hooks.

Return

true|false. Whether the query is for a search.

Usage

global $wp_query;
$wp_query->is_search();

Changelog

Since 3.1.0 Introduced.

WP_Query::is_search() code WP 6.1.1

public function is_search() {
	return (bool) $this->is_search;
}