Open jrfnl opened 7 years ago
The simplest way would be to add it as a restricted function as part of #9
If a theme can't use the wp_title function, why have the function? I found it very useful for the h1 heading on archive pages or in index.php.
@joyously You should be using add_theme_support( 'title-tag' ); or
the_archive_title` instead.
why have the function?
Like everything it was introduced when there was a need and now we have found a better way to solve the problem.
The function was nearly deprecated in WP 4.4 and so that chances are high it will be deprecated in the future. https://make.wordpress.org/core/2015/10/20/document-title-in-4-4/
@grappler
You should be using
add_theme_support( 'title-tag' );
orthe_archive_title
instead.
The h1 heading is not handled by the title-tag theme_support and the_archive_title
doesn't have all the same filters on it as wp_title
.
the_archive_title
doesn't have all the same filters on it aswp_title
.
You can always use the filter get_the_archive_title
to make changes. wp_title()
should only be used to add the title in the head
tags.
You can always use the filter get_the_archive_title to make changes.
That's not the point. There could be plugins and child themes that are filtering wp_title
and not the_archive_title
. The theme should be able to call the wp_title
function if it wants to.
Rule type:
Error
Rule:
Check that there are no calls to
wp_title()
Ref: https://make.wordpress.org/themes/handbook/review/required/#core-functionality-and-features
Theme check file covering this rule:
https://github.com/WordPress/theme-check/blob/master/checks/title.php
Notes for implementation:
wp_title
. This sniff should not confused the filter with a function call.To do: