I am getting these three warnings while running the theme-check plugin.
REQUIRED: The theme must not used the <title>
tags.
REQUIRED: The theme must not call to wp_title().
REQUIRED: The <title>
tags can only contain a call to wp_title(). Use
the wp_title filter to modify the output
I am using this in my headers <title></title>
tags.
<title><?php wp_title('|', true, 'right'); ?><?php bloginfo('name');?></title>
Something has changed in WordPress or I am not following some concrete steps?
WordPress added support for the title-tag
feature in version 4.1 and it’s now a required feature for themes uploaded to the repo.
To implement this feature, make sure your theme does not have the title tag hard coded within header.php
, e.g.:
<title><?php wp_title( '|', true, 'right' ); ?></title>
Configure your theme with title-tag support like this:
add_action( 'after_setup_theme', 'wpse_theme_setup' );
function wpse_theme_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' );
}
To make changes to the title text, use the following filters (source):
-
pre_get_document_title
short-circuits wp_get_document_title()
if it
returns anything other than an empty value.
-
document_title_separator
filters the separator between title parts.
-
document_title_parts
filters the parts that make up the document
title, passed in an associative array.