WordPress.org

Make WordPress Core

Opened 16 months ago

Closed 7 weeks ago

#23724 closed enhancement (fixed)

Pass $post into 'protected_title_format' and 'private_title_format' filters

Reported by: johnjamesjacoby Owned by: SergeyBiryukov
Milestone: 4.0 Priority: low
Severity: minor Version: 3.5
Component: Posts, Post Types Keywords: has-patch
Focuses: template Cc:

Description

Currently it's only possible to change these prefixes globally.

Being able to change these prefixes based on specific $post data would be helpful for narrowing down the scope, say to specific custom post types.

I noticed also that we don't pass $post into the 'the_title' filter, which could cut down on an additional get_post() call later if we pass it here. Obviously not essential, but wouldn't hurt.

Attachments (3)

23724.patch (909 bytes) - added by johnjamesjacoby 16 months ago.
23724.2.patch (786 bytes) - added by johnjamesjacoby 16 months ago.
23724.3.patch (1.5 KB) - added by DrewAPicture 7 weeks ago.
refresh + hook docs

Download all attachments as: .zip

Change History (10)

johnjamesjacoby16 months ago

comment:1 follow-up: SergeyBiryukov16 months ago

  • Version changed from trunk to 3.5

I noticed also that we don't pass $post into the 'the_title' filter, which could cut down on an additional get_post() call later if we pass it here. Obviously not essential, but wouldn't hurt.

I've found 14 instances of applying the_title filter in current trunk. Changing it in one place would be inconsistent, so this should be done a separate ticket. Previous inconsistencies (passing only one parameter) were fixed in #13558 and #16688.

Passing $post to protected_title_format and private_title_format makes sense to me.

comment:2 in reply to: ↑ 1 johnjamesjacoby16 months ago

Replying to SergeyBiryukov:

I've found 14 instances of applying the_title filter in current trunk. Changing it in one place would be inconsistent, so this should be done a separate ticket. Previous inconsistencies (passing only one parameter) were fixed in #13558 and #16688.

I hadn't considered these. Very much agree this bit needs a rethink. Will repatch without that bit.

Version 0, edited 16 months ago by johnjamesjacoby (next)

johnjamesjacoby16 months ago

comment:3 nacin5 months ago

  • Component changed from Template to Posts, Post Types
  • Focuses template added

comment:4 obenland7 weeks ago

  • Keywords needs-refresh added

comment:5 obenland7 weeks ago

Needs refresh with filter documentation update.

DrewAPicture7 weeks ago

refresh + hook docs

comment:6 DrewAPicture7 weeks ago

  • Keywords needs-refresh removed
  • Milestone changed from Awaiting Review to 4.0

23724.3.patch adds the hook doc updates.

comment:7 SergeyBiryukov7 weeks ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 28571:

Pass $post to 'protected_title_format' and 'private_title_format' filters.

props johnjamesjacoby, DrewAPicture.
fixes #23724.

Note: See TracTickets for help on using tickets.