[wp-trac] [WordPress Trac] #24330: When adding the post_formats_compat the_content filter a post ID argument should be included

WordPress Trac noreply at wordpress.org
Mon May 13 17:07:55 UTC 2013


#24330: When adding the post_formats_compat the_content filter a post ID argument
should be included
--------------------------+-----------------------------
 Reporter:  gcorne        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Post Formats  |    Version:  trunk
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 The new {{{post_formats_compat()}}} function relies on knowing the
 {{{$post_id}}} to get meta data for the post format. By default, the
 function is bound as a {{{the_content}}} filter, which doesn't pass a
 {{{$post_ID}}}. One possible solution is to change the number of accepted
 arguments when adding the filter to 2, although this will require third-
 party developers that are calling {{{apply_filters( 'the_content',
 $content )}}} with an unset {{{$GLOBALS['post']}}} or the global set to a
 different post to pass in the post id: {{{ apply_filters( 'the_content',
 $content, $post_id )}}}.

 wp-includes/comment.php:1752 is an example from core of using
 {{{the_content}}} on content that is not pulled from the global
 {{{$post}}}.

 For completeness, it may make sense to do the same with the
 {{{prepend_attachment}}} filter.

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


More information about the wp-trac mailing list