Opened 5 months ago
Last modified 5 months ago
#61555 new enhancement
Add deprecation notice to wp_title()
Reported by: | anonymized_14808221 | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Themes | Keywords: | needs-docs 2nd-opinion |
Focuses: | Cc: |
Description (last modified by )
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 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.
Change History (3)
#1
@
5 months ago
- Description modified (diff)
- Keywords needs-patch removed
- Type changed from defect (bug) to enhancement
- Version trunk deleted
#2
@
5 months ago
I made a few Codex changes for now:
- Replaced the sentence about `wp_title` with "Use the Title_Tag theme feature to set the
<title>
element withinwp_head()
" (and moved it below the list item aboutwp_head()
). - Updated the Document Header section in the Spanish page (which was not translated anyway) to match the revised English content.
- Removed the hardcoded
title
and stylesheet from the examples in the Korean and Chinese pages.
#3
@
5 months ago
I am not sure to understand why "just" because some older software still uses certain functions, functions are undeprecated.
I am sure we could find hundreds or more plugins/themes that use deprecated functions, yet we wouldn't undeprecate them, rather we'd ask or expect those plugins/themes to update.
The risk at not deprecating, or putting a "doing it wrong" in place (I guess this could also be done dynamically depending on theme or wp version running) is that developers use it. They do not always rely on the documentation.
---
Note that I had opened tickets about the wrong link to a missing note in the codex, see
- https://github.com/WordPress/Documentation-Issue-Tracker/issues/1620 (solved through this trac)
- https://github.com/WordPress/Documentation-Issue-Tracker/issues/1624
---
Thanks for the changes made!
[35624] purposely un-deprecated
wp_title()
, and the oldest five bundled themes still use it. Block themes should not need eitherwp_title()
oradd_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 not yet fully replaced. I could remove the
wp_title
mentions in the Theme Development Codex page, but that probably should link to the Title Tag page while it remains available there. Or at least I could remove the "See why" link to a missing note that was deleted even before redirecting the page in 2015.