#35253 closed defect (bug) (invalid)
The codex says the_title filter is deprecated
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.4 |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description (last modified by )
the_title filter is marked as deprecated in 4.4 on https://codex.wordpress.org/Plugin_API/Filter_Reference/the_title
The replacements suggested also change the <title> tag. I'm using the_title filter to modify the page's title ("entry title"), not the title tag with the code below. If one does not use the_title, then there does not seem to be a way to change the post title without changing the <title> tag, too.
So, is there a better filter or is this mis-marked in the codex as deprecated?
function jspr_headline( $title, $id) { if ( is_page( $id) && $field = get_field('page_headline') ) { return $field; } else { return $title; } } add_filter( 'the_title', 'jspr_headline', 10, 2 );
Change History (4)
#1
@
9 years ago
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
#2
follow-up:
↓ 4
@
9 years ago
@swissspidy I will say that the code reference definitely makes it looks like the_title
is deprecated, even though it is just looking at its uses in deprecated.php
. We might want to ping meta and see if there is a way to fix that.
#4
in reply to:
↑ 2
@
9 years ago
Replying to chacha102:
I will say that the code reference definitely makes it looks like
the_title
is deprecated, even though it is just looking at its uses indeprecated.php
. We might want to ping meta and see if there is a way to fix that.
See #meta1085.
Hi there
Thanks for your report and welcome to trac.
The codex entry is wrong. The
the_title
filter is not deprecated. In fact, there's currently not even a way to deprecate filters.It looks like the person who added that note mixed something up.
If you're unsure about a Codex entry, have a look at the code reference. There you can see if something is really deprecated or not.
Ps. If you find misleading information on the codex (e.g. when the information isn't the same as in the code reference), you can also go ahead and just edit it.