Retrieve the contents of the search WordPress query variable.
The search query string is passed through {@link esc_attr() to ensure that it is safe for placing in an html attribute.
Signature
get_search_query( $escaped = true )
- escaped
- (boolean) Whether the result is escaped. Default true. Only use when you are later escaping it. Do not use unescaped.
Default:true
Return
(string)
Source
function get_search_query( $escaped = true ) {
$query = apply_filters( 'get_search_query', get_query_var( 's' ) );
if ( $escaped )
$query = esc_attr( $query );
return $query;
}
WP Trac GitHub Bitbucket
Link here
-
URL
http://queryposts.com/function/get_search_query/ -
HTML
<a href='http://queryposts.com/function/get_search_query/'>get_search_query()</a> -
Markdown
[get_search_query()](http://queryposts.com/function/get_search_query/) -
BBCode
[url=http://queryposts.com/function/get_search_query/]get_search_query()[/url]