Show Your Search Query in WordPress

Wouldn’t you like to be able to display the actual search term entered by your user on the search results’ page? Good thing there is a very simple way in WordPress to do that with the_search_query function. Just open up your search.php file and enter:

to display the search term that was entered. So something like this:
would display something that looked like this: Search Results for “the search term” Another cool little trick it to add the number of search results. Use this code:
post_count;
echo $num.' search results for "'; the_search_query();
?>
to display something like: 18 search results for “the search term”
Search

Popular Posts

Small Biz Website Tips Newsletter

Stay up to date with the latest marketing, sales, and service tips and news.

Small Biz Website Tips Newsletter

Stay up to date with the latest marketing, sales, and service tips and news.