[wp-trac] [WordPress Trac] #61555: Add deprecation notice to wp_title()
WordPress Trac
noreply at wordpress.org
Wed Jul 3 14:12:32 UTC 2024
#61555: Add deprecation notice to wp_title()
------------------------------------+------------------------------
Reporter: bedas | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Themes | Version:
Severity: normal | Resolution:
Keywords: needs-docs 2nd-opinion | Focuses:
------------------------------------+------------------------------
Changes (by sabernhardt):
* keywords: needs-docs 2nd-opinion needs-patch => needs-docs 2nd-opinion
* version: trunk =>
* type: defect (bug) => enhancement
Old description:
> The function wp_title() simply never considers is_front_page to be true,
> and as such is broken.
>
> ''Legacy themes for example use wp_title'', see
> https://core.trac.wordpress.org/ticket/57778, and the codex itself still
> says you must use it https://codex.wordpress.org/Theme_Development,
> **although I know that is not true anymore, in fact nowadays you must use
> add_theme_support instead.**
>
> ---
>
> I suggest to add a deprecation notice to this function, because afaik it
> is not used in wp-core and as such, since broken anyway, shouldn't be
> possible to be used in new code, and old code should be warned, if using
> it.
New description:
The function `wp_title()` simply never considers `is_front_page` to be
true, and as such is broken.
''Legacy themes for example use wp_title'', see #57778, and the
[https://codex.wordpress.org/Theme_Development#Document_Head_.28header.php.29
Codex itself still says you must use it], **although I know that is not
true anymore, in fact nowadays you must use `add_theme_support` instead.**
---
I suggest to add a deprecation notice to this function, because afaik it
is not used in wp-core and as such, since broken anyway, shouldn't be
possible to be used in new code, and old code should be warned, if using
it.
--
Comment:
[35624] purposely un-deprecated `wp_title()`, and the oldest five bundled
themes still use it. Block themes should not need either `wp_title()` or
`add_theme_support( 'title-tag' )`, though they still have a bug with
network signup and activation pages (#55023).
Of course, the documentation can be corrected and improved. The Codex is
severely outdated overall but [https://github.com/WordPress/Documentation-
Issue-Tracker/issues/1506 not yet fully replaced]. I could remove the
`wp_title` mentions in the
[https://codex.wordpress.org/Theme_Development#Document_Head_.28header.php.29
Theme Development Codex page], but that probably should link to the
[https://codex.wordpress.org/Title_Tag Title Tag page] while it remains
available there. Or at least I could remove the
[https://web.archive.org/web/20131207182243/http://codex.wordpress.org/Function_Reference/wp_title#Note
"See why" link to a missing note] that was deleted even before redirecting
the page in 2015.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/61555#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list