the_search_query() WordPress Function
The the_search_query() WordPress function outputs the contents of the search query variable. This is useful for displaying the search query in the results page.
the_search_query() #
Displays the contents of the search query variable.
Description
The search query string is passed through esc_attr() to ensure that it is safe for placing in an HTML attribute.
Source
File: wp-includes/general-template.php
function the_search_query() { /** * Filters the contents of the search query variable for display. * * @since 2.3.0 * * @param mixed $search Contents of the search query variable. */ echo esc_attr( apply_filters( 'the_search_query', get_search_query( false ) ) ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
2.1.0 | Introduced. |