How to remove site description from page titles in WordPress

Although it is only a short sentence long, a tagline can be more important than you might actually think. This sentence is used to describe your entire site and is one of the first things a visitor will notice after the page loads. Of course, if you decide to show a tagline on the homepage.

If a user was redirected to your site from a search engine like Google is, tagline might be a description which that user saw even before deciding to click the link.

Without any doubt, the tagline is important, but sometimes you won’t need it everywhere. Sometimes, it is better to leave the tagline empty than having an inappropriate one. Depending on your theme, the tagline can be displayed on numerous positions and it might be shown right there on top of your window/tab and more importantly in search engine results. And if that’s something you don’t want, you can easily make the change.

Remove site description from pages titles:

In WordPress 4.4, a new filter was introduced. This filter allows you to directly target parts of the title displayed in the head tag. Since tagline is part of the title, you can easily choose not to display one:

  1. Open functions.php
  2. Copy and paste the following code:
  3. function remove_tagline($title)
    
    {
    
    if(isset($title['tagline']))
    
    {
    
    unset($title['tagline']);
    
    }
    
     
    
    return $title;
    
    }
    
    add_filter('document_title_parts', 'remove_tagline');
  4. Save changes

That’s all you have to do. If the tagline was set to be displayed in your title, this function will stop one from showing. Before you start worrying about your posts and pages titles, you should know that this function only takes care of the title tag in the head tag. Your posts and pages titles will be intact. Also, this function won’t hide tagline from showing on the homepage or any other places your theme had placed it on.

Similarly, you can change title tag for each one of your posts and even change title separator throughout your website.

START YOUR OWN BLOG

This guide is an introduction to mastering the art of blogging. It provides easy to follow steps to start, maintain, and grow your blog.

Read the guide

Leave a Reply

Your email address will not be published. Required fields are marked *