Update search results page title

Forums › Forums › Search & Filter Pro › Update search results page title

Tagged: ,

Viewing 4 posts – 1 through 4 (of 4 total)
  • Anonymous
    #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.

    Trevor
    #123805
    This reply has been marked as private.
    Anonymous
    #123813

    Hi 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
    #155423

    Closing 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

Viewing 4 posts – 1 through 4 (of 4 total)

Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.