Since WordPress 4.1, WordPress allows automatic creation of document title tags. This is a very useful option for most SEO practices because the title tag structure can change depending on the context of page.
1. Add Theme Support for Automatic Title Tags
To enable automatic title tags, first, you need to add theme support in your theme setup function:
add_theme_support( 'title-tag' ); // Enable automatic title tags
<title> Tags From Header Template
After you add theme support, you have to remove
<title> tag from your
header.php file. Otherwise, you can get duplicate title tags, which is bad for page SEO.
That’s it. After you complete those steps, your title tag is now automatically generated by WordPress.
This function also enables SEO plugins to better manage your site’s SEO titles.