[wp-trac] [WordPress Trac] #21864: PHPDoc incorrect with the return value of add_*_meta functions

WordPress Trac wp-trac at lists.automattic.com
Mon Sep 10 23:37:28 UTC 2012


#21864: PHPDoc incorrect with the return value of add_*_meta functions
-------------------------------------+------------------------------
 Reporter:  mark8barnes              |       Owner:
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  Inline Docs              |     Version:  3.4.2
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |
-------------------------------------+------------------------------

Comment (by mark8barnes):

 Replying to [comment:2 nacin]:
 > Not sure if there's any need though for update_metadata() to bother to
 return the meta ID.
 I can't think of a use case, and the existing system does have the
 advantage of different returns depending on whether the metadata was
 updated or added. But if you want to retain that, the documentation needs
 changing. Yet for consistency, I think returning the id would be better.


 > Even more so, not sure if there's any need for the add_*_meta()
 functions to return the meta ID, though that's probably been out in the
 wild long enough to be considered functionality.

 Metadata IDs are quite hard to get out of WordPress (there's no function
 to get the metadata ID from a given key and value, for example). But if
 you want to be 100% sure you're accessing or deleting the right metadata,
 then you need them. If I had my way, I'd be ''adding'' functions that gave
 access to metadata ids, not removing them! (In my case I needed the
 meta_id after adding metadata so that I could include it in a AJAX return,
 and the metadata could then be further manipulated by the user. Without
 the meta_id they could only add metadata via AJAX, they couldn't add then
 edit it via AJAX.)

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


More information about the wp-trac mailing list