[wp-trac] [WordPress Trac] #24154: Use seperate filter hooks for formatting and displaying content

WordPress Trac noreply at wordpress.org
Mon Apr 22 06:00:22 UTC 2013


#24154: Use seperate filter hooks for formatting and displaying content
-----------------------------+-------------------------
 Reporter:  bungeshea        |       Type:  enhancement
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  Formatting
  Version:                   |   Severity:  trivial
 Keywords:                   |
-----------------------------+-------------------------
 The functions that format the post content are hooked to `the_content`
 filter. So if I wanted to format some text in the same way the post
 content is formatted, I'd use `apply_filters( 'the_content',
 $text_to_format );`

 However, some plugins (especially social sharing buttons, Jetpack is an
 offender) hook to `the_content` to add additional output to the end of the
 post content. This really messes up when formatting text using
 `the_content` filter, as you get all of these social sharing buttons and
 related posts tacked onto the end of it. Currently the only way to safely
 format custom text is to apply the functions manually.

 Instead, let's hook those formatting functions to a separate hook (eg:
 `format_content`), which is then applied to the post content along with
 `the_content`. New plugins can use the `format_content` hook to format
 their custom text, existing plugins don't break and everyone is happy.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/24154>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list