get_search_query

Definition:
function get_search_query( $escaped = true ) {}

Retrieve the contents of the search WordPress query variable.
The search query string is passed through esc_attr() to ensure that it is safe for placing in an html attribute.

Parameters

  • bool $escaped: Whether the result is escaped. Default true. Only use when you are later escaping it. Do not use unescaped.

Defined filters

  • get_search_query
    apply_filters( 'get_search_query', get_query_var( 's' )

Source code

function get_search_query( $escaped = true ) {

	$query = apply_filters( 'get_search_query', get_query_var( 's' ) );

	if ( $escaped )

		$query = esc_attr( $query );

	return $query;

}

1677

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: