[wp-trac] [WordPress Trac] #18210: Update_post_meta is case insensitive on meta_key, but get_post_meta is NOT

WordPress Trac noreply at wordpress.org
Mon Jun 22 03:13:46 UTC 2015


#18210: Update_post_meta is case insensitive on meta_key, but get_post_meta is NOT
-------------------------------------------------+-------------------------
 Reporter:  anmari                               |       Owner:
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
Component:  Database                             |  Review
 Severity:  normal                               |     Version:  3.2
 Keywords:  dev-feedback needs-patch needs-      |  Resolution:
  unit-tests                                     |     Focuses:
                                                 |  performance
-------------------------------------------------+-------------------------

Comment (by kdoole):

 I don't know of / couldn't find best practices around this.

 The collation can be changed in the query statement, so one option would
 be adding `COLLATE utf8_general_cs` when adding / updating / deleting
 meta. Would it be worthwhile to benchmark the performance difference
 between `ci` and `cs`?

 Another option would be allowing users to set this themselves with a
 parameter when using the various get/update/insert/delete post meta fns.
 Seems like overkill though. Is it at all useful to let people make meta
 fields case sensitive?

 Perhaps it's simply a matter of updating `get_post_meta` to be case
 INsensitive (and noting in the codex that post meta keys are case
 insensitive) so that everything works consistently.

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


More information about the wp-trac mailing list