Is there a way to override the tag specified in header.php?

First, let’s change your <title> to

<title><?php wp_title(' | ', true, 'right'); ?></title>

Because adding to the title string in that was isn’t very future-forward, instead it’s best to use a filter to do any modifications to the title. So let’s instead ad (in functions.php):

add_filter('wp_title', 'my_custom_title');
function my_custom_title( $title )
{
    // Return my custom title
    return sprintf("%s %s", $title, get_bloginfo('name'));
}

Then let’s extend this handy little title filter to do what you’re wanting to do:

add_filter('wp_title', 'my_custom_title');
function my_custom_title( $title )
{
    if( is_singular("your_post_type"))
    {
        return ""; // Return empty
    }
    // Return my custom title
    return sprintf("%s %s", $title, get_bloginfo('name'));
}

Leave a Comment