[wp-trac] [WordPress Trac] #18196: Post Meta API Cleanup

WordPress Trac wp-trac at lists.automattic.com
Fri Sep 30 17:41:43 UTC 2011


#18196: Post Meta API Cleanup
--------------------------+-----------------------
 Reporter:  ryan          |       Owner:
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:  3.3
Component:  General       |     Version:  3.2.1
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |
--------------------------+-----------------------
Changes (by duck_):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 There are some more places where we can make better use of the metadata
 API.

 Patched:

 * do_all_pings() can use delete_metadata_by_mid() and we don't need to
 perform the second query to retrieve the meta_id since we already get it.

 Other possibilities which didn't work out straight away:

 * do_enclose(): unfortunately the code could produce an array of meta IDs
 to delete... but I'm mentioning it because in it's current state this
 doesn't work anyway as preparing the implode will produce something like
 `IN('1,2,3')`

   The metadata addition also uses a direct query, maybe this could be
 swapped for add_post_meta or add_metadata (though this would require back
 compat _postmeta actions)

 * wp_delete_post() and wp_delete_attachment(): both delete an array of
 meta IDs.

 * _publish_post_hook(): adding post meta with a query, see above for note
 about switching to add_post_meta or add_metadata

 Splitting some of the above out into separate tickets for discussion,
 particularly do_enclose() which really needs a clean up, might be best.

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


More information about the wp-trac mailing list