Skip to content

Change the “You searched for…” Subheading for Search Results

Important

Since Total 3.6.0 this no longer applies because the subheading has been removed from the search results. To alter the search results title you need to use a different filter to alter the page header title "string".

The following snippet can be used to alter the subheading on the search results page.

/**
 * Change the "You searched for..." Subheading for Search Results.
 *
 * @link https://totalwptheme.com/docs/snippets/searched-for-subheading/
 */
add_filter( 'totaltheme/page/header/subheading', function( $string ) {
	if ( is_search() ) {
		return 'Search results for: '.  esc_html( get_search_query( false ) ); /// CHANGE THIS LINE
	}
	return $string;
} );
All PHP snippets should be added via child theme's functions.php file or via a plugin.
We recommend Code Snippets (100% Free) or WPCode (sponsored)
Related Snippets
Back To Top