[wp-trac] [WordPress Trac] #21309: Introduce WP_Post class

WordPress Trac wp-trac at lists.automattic.com
Tue Jul 31 22:03:54 UTC 2012


#21309: Introduce WP_Post class
----------------------------+------------------
 Reporter:  scribu          |       Owner:
     Type:  task (blessed)  |      Status:  new
 Priority:  normal          |   Milestone:  3.5
Component:  General         |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |
----------------------------+------------------

Comment (by scribu):

 Replying to [comment:24 ryan]:
 > Magic for ->post_category, tags_input, and tax_input would allow us to
 deprecate wp_get_single_post().

 I don't know. We should keep `WP_Post->__get()` fairly light, as it gets
 called ''a lot''.

 > Both WP_Post->filter and WP_Post->post->filter exist. I guess because of
 to_array().

 Hm... I didn't notice that; will investigate.

 > get_object_vars() will no longer return much if fed WP_Post. We use
 get_object_vars() in get_children(), sanitize_post(),
 wp_get_recent_posts(), wp_update_post(), _wp_put_post_revision(),
 wp_get_post_revision(), and elsewhere.

 Right, will have to fix those.

 > I notice that several plugins including the bbPress plugin also do this.

 It was the same situation when we started returning WP_User everywhere.
 There's nothing we can do, except encouraging the authors to use
 `get_post( $id, ARRAY_A )` instead.

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


More information about the wp-trac mailing list