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

WordPress Trac noreply at wordpress.org
Mon May 14 09:29:40 UTC 2018


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

 * keywords:  has-patch needs-testing dev-feedback => has-patch needs-unit-
     tests
 * focuses:   => rest-api
 * milestone:  Awaiting Review => 5.0


Comment:

 This should be tackled after #38323.

 @spacedmonkey For the approach, I suggest we follow how option defaults
 are handled. Based on the work in the above ticket, we can introduce
 filters like `default_{$object_type}_meta_{$meta_key}` and
 `default_{$object_type}_meta_{$meta_key}_for_{$object_subtype}`. In
 `register_meta()`, when a default is passed, we can hook in a new filter
 function similar to `filter_default_option()`, that would take care of
 what you did in `get_metadata_default()` in
 [attachment:meta_default.diff].

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


More information about the wp-trac mailing list