Support » Plugin: Theme Check » using add_theme_support( ‘title-tag’ ); getting "REQUIRED" note.

  • Resolved webrockers

    (@webrockers)


    I am getting the following two lines:

    REQUIRED: The theme needs to have a call to wp_title(), ideally in the header.php file.
    REQUIRED: The theme needs to have <title> tags, ideally in the header.php file.

    I just removed wp_title() in favor of using
    add_theme_support( ‘title-tag’ );
    in functions.php.

    So, what’s wrong? What did I miss?

    https://wordpress.org/plugins/theme-check/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Are you running an old version of the theme check plugin? The latest version knows about the title tag support and will not give you those errors if you have it correctly implemented.

    Thanks for your reply,
    it’s Version 20151211.1

    I implemented it in functions.php like this:

    function debus_diebold_2015_setup() {
        add_theme_support( ‘title-tag’ );
    }
    endif;
    add_action( 'after_setup_theme', 'debus_diebold_2015_setup' );

    After reading some other support requests and getting also the following recommendation, it rang a bell:

    RECOMMENDED: No reference to add_theme_support( "title-tag" ) was found in the theme. It is recommended that the theme implement this functionality for WordPress 4.1 and above.

    So I changed the quotation marks to double quotes, checked again, and now it works.

    I agree, that it is impossible to check against every way of coding a solution.

    Thank you for this plugin!

    Best wishes, happy holidays …
    Marco

    Plugin Author Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    The code actually allows for either single or double quotes.

    http://plugins.svn.wordpress.org/theme-check/trunk/checks/title.php

    Are you sure you were not using something invalid like curly quotes?

    Edit: just noticed that your example uses back ticks instead of quotes. Yeah, that won’t work. 🙂

    Ah, now we know!

    Changed it to
    add_theme_support( 'title-tag' );

    and I can confirm, it works now.

    Thanks for your time!
    Marco

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘using add_theme_support( ‘title-tag’ ); getting "REQUIRED" note.’ is closed to new replies.