Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Required: The "<title>" tags can only contain a call to "wp_title()". Use the "wp_title filter" to modify the output. #191

Closed
ghost opened this issue Jun 12, 2017 · 9 comments
Assignees

Comments

@ghost
Copy link

ghost commented Jun 12, 2017

Despite using

if ( ! function_exists( 'theme_setup' ) ) :

// @since Themename 1.0

function theme_setup() {
   // Add theme support for document Title tag
  add_theme_support( 'title-tag' );
}

endif; // theme_setup

add_action('after_setup_theme', 'theme_setup' );

I get

<title>" tags can only contain a call to "wp_title()". Use the  "wp_title filter" to modify the output.

when using Themecheck with wp-cli. I have no title tag in the header.

This theme doesn't seem to display tags. Modify it to display tags in appropriate locations.

Support for all other checks are added and work.

What can I do to pass this check in WordPress 4.8 please?

I have seen and tried all the other suggestions regarding the title-tag function but none of it works, not even https://gist.github.com/tommcfarlin/958b57e0b7c78e9ff13e.

@ghost
Copy link
Author

ghost commented Jun 12, 2017

I found what it was! It was a, you will be laughing, <title> tag commented out in the HTML.
Once I deleted the commented <title> tag the check passed.
So this means the check scans for all instances of <title> regardless of if it is in a comment or not.

@macthecoder
Copy link

@monolux I didn't find anything like what did you find, but still I am facing such problem.

@ThemeCSS
Copy link

Same here. I am really confused. I added add_theme_support( 'title-tag' ); in my functions.php but still got issue.

@macthecoder
Copy link

I find out the solution already. You have to check not to only on your main header from file but also throughout the whole theme. I did it on my theme's maintenance mode index file. You are not supposed to add any html <title> tag in anywhere throughout your theme. Check this out throughout the theme. Remove it from theme. This is the only solution of it.

@ThemeCSS
Copy link

@macthecoder I already tried this search every file I have and I did not find that <title> tag. Or does a file with title string causes this issue?

@macthecoder
Copy link

Not at all. Search throughout the project with Patience. It causes for what I said before. There is no reason but occur for this issue. It only causes if you use any html <title> tag, not for any word like title.

@ThemeCSS
Copy link

Thanks @macthecoder I re-check all my files and I found out that it was on one of my widgets. Thanks again!

@macthecoder
Copy link

Welcome.

@carolinan
Copy link
Collaborator

A solution here would be to add file name and line number to the output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants