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

WordPress Trac noreply at wordpress.org
Tue Jun 26 23:56:54 UTC 2018


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

Comment (by spacedmonkey):

 That was going to be a my next question.

 Should the default value, obey the `single` an `type` definitions? Should
 be cast the default value, to make sure it returns the right type. Say
 make sure it is returning a number instead an array for example.

 It also seems like the rest api has decided for us, by only allowing a
 single value to returned as a default. See
 [https://github.com/WordPress/WordPress/blob/194d534babe8e164fc32cd83d985a7167bd0f390
 /wp-includes/rest-api/fields/class-wp-rest-meta-fields.php#L342 this
 line].

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


More information about the wp-trac mailing list