Codex

Function Reference/get search query

This page is marked as incomplete. You can help Codex by expanding it.

get_search_query()

This function is used to get the query string when a user performs a search on the site. It returns the query string rather than displaying it, as the the_search_query() function does.

Example

Examples of the different usage methods.
<?php the_search_query(); ?>
OR
<?php echo get_search_query(); ?>