2

My WordPress site's title not showing. It's just displaying the domain like, www.example.com.

Please suggest how to display the proper title tag.

1 Answer 1

7

Add this code to your functions.php

if ( !function_exists( 'yourtheme_setup' ) ) {
    function yourtheme_setup() {
        /*
         * Let WordPress manage the document title.
         * By adding theme support, we declare that this theme does not use a
         * hard-coded <title> tag in the document head, and expect WordPress to
         * provide it for us.
         */
        add_theme_support( 'title-tag' );
    }

    add_action( 'after_setup_theme', 'yourtheme_setup' );
}

Or, if your functions.php already have after_setup_theme, just add the line add_theme_support( 'title-tag' ); into your after_setup_theme. (Source)

1
  • Of note: if you add this, but you have already included a title tag in your header.php (in an effort to figure out what's going on perhaps), then this will have no effect. Sep 14 at 17:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.