[wp-trac] [WordPress Trac] #44238: Add protected param to register meta

WordPress Trac noreply at wordpress.org
Sat May 26 12:49:23 UTC 2018


#44238: Add protected param to register meta
--------------------------------+------------------------------
 Reporter:  spacedmonkey        |       Owner:  (none)
     Type:  enhancement         |      Status:  new
 Priority:  normal              |   Milestone:  Awaiting Review
Component:  Options, Meta APIs  |     Version:  3.1.3
 Severity:  normal              |  Resolution:
 Keywords:  has-patch           |     Focuses:
--------------------------------+------------------------------

Comment (by spacedmonkey):

 I have written two ways of the doing this.

 The first patch,
 [https://core.trac.wordpress.org/attachment/ticket/44238/44238.diff
 44238.diff] added a param of `protected_callback` which, if set is passed
 onto the new protected_{$meta_type}_meta_{$meta_key} filter.
 This is inline with other params on the register meta api, that allow
 developers to write there own logic. If they don't want to write there own
 logic there they can always use the helper functions `__return_true` and
 `__return_false`.

 The second patch,
 [https://core.trac.wordpress.org/attachment/ticket/44238/44238.1.diff
 44238.1.diff]  is much more simple implementation, that added a boolean
 `protected`. This is much more defined if something is or is not
 conditional, but it much more restrictive. However, it makes the
 definition of a meta_key much cleaner if you look it up.

 Not sure which is better, please comment below with feedback.

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


More information about the wp-trac mailing list