I'm building a child theme and it currently has a very simple <head>
section in header.php:
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title><?php wp_title( '|', true, 'right' ); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<!--[if lt IE 9]>
<script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/js/html5shiv.min.js"></script>
<![endif]-->
<?php wp_head(); ?>
</head>
I'm guessing wp_head()
is responsible for the second <title>
element (it appears just there in the final HTML), but other things I've read say this is impossible.
Should I be removing the <title>
from my header.php, or should I be adding something to my functions to remove the title from wp_head()
(eg. remove_action('wp_head', 'title'
) ?
Or should I be doing something else altogether?
add_theme_support( 'title-tag' );
. This should explain the two title tags. This feature was introduced in 4.1 and automatically add thewp_title()
tag in the header. If so, simply copy your parent theme header.php to your child theme and delete thewp_title()
tag in the header.php