Two title tags in my header

The two title tags can be explained as that you are using a theme that is written for WordPress4.1 and actually is using 4.1. As from 4.1 you don’t need to call wp_title() in the head any more, you can make use of new title_tag theme support tag which automatically adds the wp_title() tag in the header

The parent theme you are using are most probably already doing this. Look in your functions.php for this line of code

add_theme_support( 'title-tag' );

As a solution, copy the parent theme header.php to your child theme and simply remove the wp_title() function from the child theme header.php

Here is also a great function to keep in mind for backwards compatibility and is useful for parent theme developers: (Taken from the codex)

 if ( ! function_exists( '_wp_render_title_tag' ) ) {
    function theme_slug_render_title() 
    {
        ?>
        <title>
            <?php wp_title( '|', true, 'right' ); ?>
        </title>
        <?php
    }
    add_action( 'wp_head', 'theme_slug_render_title' );
}

Leave a Comment