Support » Plugin: AMP for WP - Accelerated Mobile Pages » Remove site title from title tag

  • squeebo

    (@squeebo)


    My posts have my site name appended to the post title tags, as follows.

    <title>Post Name | Site Name</title>

    It’s bad practice to put the site name in the title tag. It was done in the early 2000s but since then Google and all major web browsers don’t need it anymore, and it’s better to leave it out.

    How do I fix this?

    On my regular theme pages I have the site title removed by using this code.

    // Remove Site Title from Page Title Tag
    add_filter('document_title_parts', 'my_fix_post_title', 1);
    function my_fix_post_title($title){
        if (!is_feed()) {
       	    $title['site'] = '';     
        }
        return $title; 
    }
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Remove site title from title tag’ is closed to new replies.