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:
<?php the_search_query(); ?>
to display the search term that was entered. So something like this:
<?php echo 'Search Results for "'; the_search_query(); echo '"'; ?>
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:
<?php
$mySearch =& new WP_Query("s=$s & showposts=-1");
$num = $mySearch->post_count;
echo $num.' search results for "'; the_search_query();
?>
to display something like:
18 search results for “the search term”






Thanks for the tips !
Best Regards
Awesome! This is exactly what I needed. Thanks!