WordPress 4.1 will be adding several major improvements for theme developers. Joost de Valk opened a ticket three years ago, requesting a better option for controlling the output of title tags. He proposed a patch that would output the title tag during the run of wp_head, based on whether the current theme has added theme_support. This implementation is finally gaining traction, after a great deal of discussion among WordPress contributors.
This week John Blackbourn, the lead for WordPress 4.1, committed a forward-compatible way for allowing plugin and theme authors to better customize the output of document titles. The upcoming release will introduce theme support for the title tag.
[php light=”true”]add_theme_support( ‘title-tag’ );[/php]
“By declaring support like this, themes acknowledge that they are not defining titles on their own and WordPress can add it safely without duplication,” core contributor Konstantin Obenland explained when outlining title tag support in his most recent post to the make/core blog.
He elaborated further on the three year long effort, saying that it also served to correct an ancient practice of Kubrick, which appended the the blog name to wp_title()
:
[php light=”true”]<title><?php wp_title(‘«’, true, ‘right’); ?> <?php bloginfo(‘name’); ?></title>[/php]
That practice became fairly standard in WordPress themes. The new theme support for the title tag will make it easier for plugins and themes to manage the document title.
New Template Functions for Archive Title and Descriptions
WordPress 4.1 also introduces a couple of new template functions for archive titles and descriptions:
get_the_archive_title()
andthe_archive_title()
for returning/displaying the title of the current term, date, post type, post format, or author archive.get_the_archive_description()
andthe_archive_description()
for returning/displaying the description associated with the current term archive.
Developers will have these new functions at their disposal, thanks to efforts from Konstantin Obenland and Drew Jaynes.
If you’re in the business building WordPress themes, you will want to take note of how to use the new title tag with backwards compatibility, as outlined by Obenland.
At this time, plugin developers are discouraged from building functionality around theme support for title tags. “The long term plan is to enable users to manage document titles from their admin, independent of which theme they’re using,” Obenland explained. Changes in WordPress 4.1 are the first step towards making title tags more plugin friendly.
It’s sad that it took this long for the title tag to be looked at. I’ve never used any SEO plug-ins except for Add Meta Tags because on some of the high-traffic WordPress sites we have or manage, we use Attracta.. SEO or XML Sitemap plug-ins have never been in our tool box.