[wp-trac] [WordPress Trac] #17935: function get_post( integer ) bypasses posts_* filters

WordPress Trac wp-trac at lists.automattic.com
Wed Jun 29 22:30:59 UTC 2011


#17935: function get_post( integer ) bypasses posts_* filters
----------------------------+------------------------------
 Reporter:  postpostmodern  |       Owner:
     Type:  defect (bug)    |      Status:  reopened
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Query           |     Version:  3.2
 Severity:  normal          |  Resolution:
 Keywords:                  |
----------------------------+------------------------------
Changes (by scribu):

 * status:  closed => reopened
 * resolution:  invalid =>
 * milestone:   => Awaiting Review


Comment:

 Ok, I agree that this can be a problem. The proposed solution threw me
 off.

 > As it exists right now, it seems you are asking developers to make
 another database call inside of the manage_posts_custom_column filter to
 get the data they need.

 What kind of data are you refering to?

 {{{
 $posts = get_posts( array('p'=>$post_ID, 'post_type'=>'any',
 'post_status'=>'any', 'suppress_filters'=>FALSE, 'posts_per_page'=>1) );
 $post = count( $posts ) ? $posts[0] : get_post( $post_ID );
 $wp_list_table->display_rows( array($post) );
 }}}

 Why would you need to call both get_posts() or get_post()? The post either
 is there or it isn't.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/17935#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list