[wp-trac] [WordPress Trac] #38176: Add 'default' to register_setting

WordPress Trac noreply at wordpress.org
Mon Oct 17 16:39:11 UTC 2016


#38176: Add 'default' to register_setting
-------------------------------------------------+-------------------------
 Reporter:  rmccue                               |       Owner:  joehoyle
     Type:  enhancement                          |      Status:  assigned
 Priority:  normal                               |   Milestone:  4.7
Component:  Options, Meta APIs                   |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch dev-feedback needs-dev-    |     Focuses:
  note needs-refresh                             |
-------------------------------------------------+-------------------------

Comment (by joehoyle):

 I somewhat interesting and controversial idea suggested by @jorbin is to
 _deprecate_ the `$default` argument for `get_option()` and instead
 recommend the use of `register_setting`, as in (I think) virtually all
 cases, one would want a consistent default for their options, and it leads
 to developer error by having to re-specify the default on every
 `get_option` call.

 I think this would be a pretty good idea, however is a small but wide
 impacting change, and I'm not sure that going this far is required just to
 support the `default` argument in `register_setting`. How about we start
 with adding it to `register_setting` but leave the deprecation of
 `default` in `get_option` for down the road?

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


More information about the wp-trac mailing list