Make WordPress Core

Opened 10 years ago

Last modified 5 years ago

#29014 new enhancement

Normalization of template tag filters

Reported by: funkatronic's profile Funkatronic Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.9
Component: Posts, Post Types Keywords:
Focuses: template Cc:


The filters for the template tags, specifically, title, content and excerpt, are not very uniform. Some of them have a filter for their get_the variant, but not others. Only the_title sends the post id through the filter while the others do not.

The included patch does the following:

  • Add get_the filters to the proper functions for get_the_title, get_the_content, get_the_excerpt
  • Added post_type specific variants of the filters ( ex. the_title_{$post->post_type}
  • All filters now pass the post id as a second argument

Attachments (1)

post-template.php.patch (4.8 KB) - added by Funkatronic 10 years ago.

Download all attachments as: .zip

Change History (3)

#1 @helen
10 years ago

  • Version changed from trunk to 3.9

#2 @Caspie
9 years ago

A very good idea for example for a cases when you want to hook the_content but also want to add some conditional logic based on the post type.

Note: See TracTickets for help on using tickets.