the_search_query()
Displays the contents of the search query variable.
Description Description
The search query string is passed through esc_attr() to ensure that it is safe for placing in an html attribute.
Source 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 code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
2.1.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
Show search query in search box
If you have just performed a search, you can show the last query in the search box:
Show search query in results page
You can display the search string on search result pages