[wp-trac] [WordPress Trac] #32565: Adding an underscore prefix meta key with a meta value provides an incorrect error message

WordPress Trac noreply at wordpress.org
Thu Jun 4 13:16:10 UTC 2015


#32565: Adding an underscore prefix meta key with a meta value provides an
incorrect error message
--------------------------+-----------------------------
 Reporter:  danielpataki  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 To reproduce this, use the custom fields section in a post to add a custom
 field. Add a hidden field (prefix the custom field name with an
 underscore) and type any value. The error returned is "Please provide a
 custom field value." which is not what the issue is, the issue is that we
 are trying to add a protected meta key.

 I've included a fix which I don't particularly like. Perhaps add_meta
 should return a WP_Error object with the correct error. This would be easy
 enough to do, but I'm not familiar enough with add_meta(), I'm not sure
 what this could break.

 I changed this in all three places the issue could occur, but I'm not sure
 this is needed. During troubleshooting it was obvious that the issue
 originates from line 1198. The other two occurrences could be line 1193
 and 1281.

 Hope this helps,

 Daniel

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32565>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list