Snippets: Alter “You searched for…” Subheading On Search Results

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

function myprefix_custom_search_for_text( $string ) {
	if ( is_search() ) {
		return 'Search results for: '.  esc_html( get_search_query( false ) ); /// CHANGE THIS LINE
	return $string;
add_filter( 'wpex_post_subheading', 'myprefix_custom_search_for_text' );

Snippet Type: PHP

Posted Under: Search

All PHP snippets should be added via a child theme's functions.php file or via the Code Snippets Plugin (or alternative plugin)