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

WordPress Trac noreply at wordpress.org
Tue Jul 7 20:46:11 UTC 2020


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

 * status:  reviewing => closed
 * resolution:   => fixed


Comment:

 In [changeset:"48402" 48402]:
 {{{
 #!CommitTicketReference repository="" revision="48402"
 REST API, Meta: Introduce support for default metadata values.

 The `register_meta()` API now officially supports specifying a default
 metadata value. When `get_metadata()` is called for a meta key that does
 not yet exist for the object, this default value will be returned instead
 of an empty string.

 A new function is introduced `get_metadata_raw` to retrieve the raw
 metadata value from the database, without applying the registered default.

 Props spacedmonkey, flixos90, rmccue, kadamwhite, mnelson4, johnbillion,
 chrisvanpatten, TimothyBlynJacobs.
 Fixes #43941.
 }}}

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


More information about the wp-trac mailing list