Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 504799

Remove site title from title tag

$
0
0

Replies: 0

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 all articles
Browse latest Browse all 504799

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>