WordPress title: wp_title() and wp_head() in conflict – WordPress Tips

By | April 19, 2019

wp_title() and wp_head() are common used functions in wordpress, wp_title() displays the title of site, post or page. wp_head() loads other resources, both of them should be used in <head></head> html tag.

In this tutorial, we will solve the problem: wp_title() and wp_head() in conflict when displaying site title.

Step 1. Find problem

I am editing a theme by following other themes, i find a theme only use wp_head() in htm head tag like this:

This theme does not use wp_title() and open home page of this theme, i find there exits <title></title> in html source code.

I follow this action, however, i find no <title></title> in my html source code.

Step 2. Fix this problem

If you do not use wp_title() in <head></head> for your theme, you should add code below into your functions.php

// Let WordPress manage the document title
add_theme_support( 'title-tag' );

Then, <title></title> appears in my html source code and this problem is fixed.

Leave a Reply