I have set my WordPress' Website title and tagline in the settings, but it's not showing in any browser tab. It only shows the website URL in the tab. When I check the source code, the tag is blank
I have checked my theme's header.php and the code is
<title><?php wp_title(''); ?>
<?php if ( is_single() ) { ?> <?php } ?>
<?php if ( is_page() ) { ?> <?php } ?>
<?php if ( is_category() ) { ?> <?php } ?>
<?php if ( is_search() ) { ?> <?php } ?>
<?php if ( is_404() ) { ?> <?php } ?>
</title>
I have also tried <title><?php wp_title('|', true, 'right'); ?></title>
All other files have the get header code. Does anyone have any suggestions? I think it's in the theme files because when I activate another theme, the title works.
I have set my WordPress' Website title and tagline in the settings, but it's not showing in any browser tab. It only shows the website URL in the tab. When I check the source code, the tag is blank
I have checked my theme's header.php and the code is
<title><?php wp_title(''); ?>
<?php if ( is_single() ) { ?> <?php } ?>
<?php if ( is_page() ) { ?> <?php } ?>
<?php if ( is_category() ) { ?> <?php } ?>
<?php if ( is_search() ) { ?> <?php } ?>
<?php if ( is_404() ) { ?> <?php } ?>
</title>
I have also tried <title><?php wp_title('|', true, 'right'); ?></title>
All other files have the get header code. Does anyone have any suggestions? I think it's in the theme files because when I activate another theme, the title works.
Share Improve this question asked Feb 4 at 23:01 Maddie's FansitesMaddie's Fansites 11 bronze badge1 Answer
Reset to default 0It looks like your header.php
is using wp_title('')
, which is deprecated and may not return anything in some cases. Also, the way it's structured, it's not properly appending the site title.
Try replacing your <title>
tag with the following code:
<title><?php bloginfo('name'); ?><?php wp_title('|', true, 'left'); ?></title>
Or, if you're using a newer version of WordPress, use:
<title><?php echo get_the_title() . ' | ' . get_bloginfo('name'); ?></title>