[wp-trac] [WordPress Trac] #43941: Add default value to register meta

WordPress Trac noreply at wordpress.org
Mon Jul 6 08:46:01 UTC 2020


#43941: Add default value to register meta
-------------------------------------------------+-------------------------
 Reporter:  spacedmonkey                         |       Owner:
                                                 |  TimothyBlynJacobs
     Type:  enhancement                          |      Status:  reviewing
 Priority:  normal                               |   Milestone:  5.5
Component:  Options, Meta APIs                   |     Version:  4.6
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests early       |     Focuses:  rest-api
  needs-dev-note                                 |
-------------------------------------------------+-------------------------

Comment (by spacedmonkey):

 Sent a long time on this ticket over the weekend. Made some key
 improvements to the patch.

 - Removed code from rest meta that was casusing a notice error on register
 meta ( this happens in core too ).
 - Added validation of type for defaults. But if type is `integer` and
 `string` is provided, then a doing it wrong message is triggered. I think
 this makes sense here and will help developers quickly debug invalid
 default types.
 - Added unit tests for post and term meta defaults.
 - Improved handling of `arrays` and `objects` default data.

 There seems to be some tests failing in my PR, but they seem completely
 unrelated to this change.

 Pinging @TimothyBlynJacobs and @kadamwhite in hopes of another review.

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


More information about the wp-trac mailing list