[wp-trac] [WordPress Trac] #14302: Object Property getters and setters

WordPress Trac wp-trac at lists.automattic.com
Tue Jul 13 23:19:08 UTC 2010


#14302: Object Property getters and setters
-------------------------+--------------------------------------------------
 Reporter:  filosofo     |       Owner:           
     Type:  enhancement  |      Status:  new      
 Priority:  normal       |   Milestone:  3.1      
Component:  Post Types   |     Version:  3.0      
 Severity:  normal       |    Keywords:  has-patch
-------------------------+--------------------------------------------------
 Currently, if you want to get or set a post object's property:
  * You have to know which database table it's located in
  * If that property is in the posts table, you have to set all properties
 to set any, via `wp_update_post` or `wp_insert_post`.
  * If that property is in the postmeta table, you have to specify that it
 be returned as a singular value (instead of an array of values)

 My patch lets WP figure out where a particular value is stored, so you
 don't have to, with two new functions:

 mixed '''get_object_property''' ( int ''$object_id'', string
 ''$prop_name'' [, bool ''$force_single'' ] )

 bool '''set_object_property''' ( int ''$object_id'', string
 ''$prop_name'', mixed ''$prop_value'' )

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


More information about the wp-trac mailing list