Forums › Forums › Search & Filter Pro › Update search results page title
Tagged: page title, yoast
- This topic has 3 replies, 3 voices, and was last updated 6 years, 10 months ago by Ross.
-
Anonymous(Private) July 31, 2017 at 5:11 pm #123798
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.
Anonymous(Private) July 31, 2017 at 5:32 pm #123813Hi Trevor, thank you for the quick reply! I tried the solution recommended in the post you linked to (using Display:post type), but it did not work for me. I need to leave the display set to archive to work with my custom page template.
Thanks for looking into it further.
Ross Moderator(Private) January 28, 2018 at 7:53 pm #155423Closing this ticket.
I can confirm that
add_filter('wpseo_title','search_form_title'); function search_form_title($title){ global $searchandfilter; if ( $searchandfilter->active_sfid() == 209) { return 'My Custom Title'; } else { return $title; } }
Still works for modifying the page title where S&F is set to display as archive, with Yoast SEO.
Thanks
-
AuthorPosts