[Resolved] How to translate the 404 page title tag “Nothing found”

Home Forums Support [Resolved] How to translate the 404 page title tag “Nothing found”

Home Forums Support How to translate the 404 page title tag “Nothing found”

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1565378
    Ingrid

    Hello!
    I was wondering how can I change the text of the title tags of the “Nothing found” page, I want to change the title tag and NOT the text inside the page, since the text inside the page is already translated to my language.

    It is showing correct then the user searches something and gets no results, but when the user visits a non existing pages the title tag shows like this:

    <title>Nothing found for X</title>

    Thanks in advance

    #1565562
    David
    Staff
    Customer Support

    Hi there,

    you can use this PHP Snippet to change the title parts for your 404,

    function theme_slug_filter_wp_title( $title_parts ) {
        if ( is_404() ) {
            $title_parts['title'] = 'ADD 404 TITLE TEXT HERE';
        }
    
        return $title_parts;
    } 
    
    // Hook into document_title_parts
    add_filter( 'document_title_parts', 'theme_slug_filter_wp_title' );
    #1566003
    Ingrid

    great,thanks!

    #1566012
    David
    Staff
    Customer Support
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.