Hello, I am unable to set the page title for the search results page when Yoast SEO plugin is active. I tried your function found in the documentation here, but it does not work with Yoast plugin title rewrites. It is using the Blog page title on the search results page.
In the past I was using another function specifically to solve this issue, but it is no longer working (I got this on the support forum here):
add_filter(‘wpseo_title’,’search_meta_title’); //wpseo_title from yoast
function search_meta_title($data){
global $searchandfilter;
if ( $searchandfilter->active_sfid() && !is_tax() && !is_archive() ) { //target search & filter results
return ‘Product Search Results | Crenshaw Lighting’;
}
else {
return $data;
}
}
I have the results page set to display as an archive, with a custom page template.
I see several others have asked this same question, but none of the recommendations have resolved this issue for me. Any other ideas on how to overwrite the Yoast page titles?
Thanks for input.