[wp-trac] [WordPress Trac] #12267: Introduce WP_Post class (was: Upgrade loop objects to provide identical presentational interfaces.)

WordPress Trac wp-trac at lists.automattic.com
Tue Jun 5 12:45:57 UTC 2012


#12267: Introduce WP_Post class
-------------------------+-----------------------------
 Reporter:  andy         |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Future Release
Component:  General      |     Version:
 Severity:  normal       |  Resolution:
 Keywords:               |
-------------------------+-----------------------------

Comment (by scribu):

 Going to limit the scope of this ticket to WP_Post only. WP_Comment can
 come later.

 One thing that this would allow is to cache only the raw post data,
 avoiding all the tip-toeing around $post->filter:

 get_permalink():

 {{{
         if ( is_object($id) && isset($id->filter) && 'sample' ==
 $id->filter ) {
                 $post = $id;
                 $sample = true;
         } else {
                 $post = &get_post($id);
 }}}

 get_post():

 {{{
         } elseif ( is_object($post) && empty($post->filter) ) {
                 _get_post_ancestors($post);
                 $_post = sanitize_post($post, 'raw');
                 wp_cache_add($post->ID, $_post, 'posts');
         } elseif ( is_object($post) && 'raw' == $post->filter ) {
                 $_post = $post;
         } else {
 }}}

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


More information about the wp-trac mailing list