Support » Theme: Garfunkel » Incorrect usage of add_theme_support( 'title_tag' ) and wp_title()

  • Resolved Nick Halsey

    (@celloexpressions)


    This theme and at several others of yours have both add_theme_support( 'title_tag' ) in functions.php and a wp_title() call in the header.php file. As of WordPress 4.4, wp_title() is somewhat deprecated and including it while also adding theme support for title tags results in, in some cases, empty title tags. This is obviously very bad for a number of things, especially SEO.

    The point of adding theme support for title tags is, essentially, acknowledging that the theme doesn’t include them via wp_title(). Even though wp_title() ended up being un-deprecated for 4.4, keeping that unconditionally is now causing empty title tags to be rendered when add_theme_support( 'title_tag' ) is also called. Specifically, I’m seeing an empty title tag followed by the correct one when logged in, but Chrome at least is using the first (empty) one. When not logged in, it seems to be giving the page title and a separator but missing the site title after the separator. Core could probably improve the way it handles this, but bottom line, the usage is incorrect in this theme. Any calls to wp_title() should be removed from your themes’ header.php files as soon as possible, since most average users will not realize that their title tags are broken.

    For reference: https://make.wordpress.org/core/2014/10/29/title-tags-in-4-1/, https://make.wordpress.org/core/2015/10/20/document-title-in-4-4/, https://make.wordpress.org/themes/2015/08/25/title-tag-support-now-required/.

    I did a quick check of around five of your themes and only one (Wilson) had the correct usage (your themes are superb, by the way, I make most of them available for users on the multisite networks I run).

Viewing 2 replies - 1 through 2 (of 2 total)
  • I confirm this with also the behavior problem.

    Theme Author Anders Norén

    (@anlino)

    Hi Nick and Pozhonks,

    I’ve submitted updates to all themes affected by this, removing the wp_title() function from the header files. Long overdue obviously, but better late than never.

    — Anders

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Incorrect usage of add_theme_support( 'title_tag' ) and wp_title()’ is closed to new replies.