[Resolved] Removing "Search Results for:" from archive title

Home Forums Support [Resolved] Removing "Search Results for:" from archive title

Home Forums Support Removing "Search Results for:" from archive title

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #900953
    Altti

    Hi there,

    I’m building a website for one of our customer. It’s in finnish language so I ran in to a problem with search results page. Is there a way to remove the text “Search Results for:” from the archive title on search result page? I don’t want to install a translation plugin just for that text. Can it be removed with a script in functions.php or something like that?

    Thanks

    #901642
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Try this filter:

    add_filter( 'gettext', function( $text ) {
        if ( 'Search Results for: %s' === $text ) {
            $text = '%s';
        }
    
        return $text;
    } );

    Let me know if that does it or not ๐Ÿ™‚

    #906468
    Altti

    Worked out perfectly. Thanks Tom.

    #906826
    Tom
    Lead Developer
    Lead Developer

    You’re welcome ๐Ÿ™‚

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.