[wp-trac] [WordPress Trac] #35797: delete_metadata should only delete metadata cache entries with the value specified in $meta_value arg

WordPress Trac noreply at wordpress.org
Thu Feb 11 12:30:54 UTC 2016


#35797: delete_metadata should only delete metadata cache entries with the value
specified in $meta_value arg
--------------------------------+------------------------------------------
 Reporter:  rahal.aboulfeth     |       Owner:
     Type:  defect (bug)        |      Status:  new
 Priority:  normal              |   Milestone:  Awaiting Review
Component:  Options, Meta APIs  |     Version:  trunk
 Severity:  normal              |  Resolution:
 Keywords:  has-patch           |     Focuses:  administration, performance
--------------------------------+------------------------------------------

Comment (by rahal.aboulfeth):

 The $meta_value comment says : Metadata value. Must be serializable if
 non-scalar. If specified, only delete metadata entries with this value.
 Otherwise, delete all entries with the specified meta_key. Pass `null,
 `false`, or an empty string to skip this check. (For backward
 compatibility,it is not possible to pass an empty string to delete those
 entries with an empty string for a value.)

 The $delete_all comment says : Optional, default is false. If true, delete
 matching metadata entries for all objects, ignoring the specified
 object_id. Otherwise, only delete matching metadata entries for the
 specified object_id.

 If I understand correctly , the '''matching metadata''' applies to entries
 where ''both key and value'' match , and not only the key. The fact is, if
 we try using this call with the _thumbnail_id for example, will will
 certainly get consume all the memory with wpbd:get_col .


 But I think we can use an other conditional to add "AND meta_value = %s"
 if the $meta_value is specified. what do you think?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35797#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list