[wp-trac] [WordPress Trac] #41254: Add $default to pre_option_{$option} filter

WordPress Trac noreply at wordpress.org
Thu Jul 6 05:22:27 UTC 2017


#41254: Add $default to pre_option_{$option} filter
--------------------------------+-----------------------------
 Reporter:  sc0ttkclark         |      Owner:
     Type:  enhancement         |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  Options, Meta APIs  |    Version:  4.4
 Severity:  normal              |   Keywords:
  Focuses:                      |
--------------------------------+-----------------------------
 Currently the pre_option_{$option} filter passes two options:

 {{{

         /**
          * Filters the value of an existing option before it is retrieved.
          *
          * The dynamic portion of the hook name, `$option`, refers to the
 option name.
          *
          * Passing a truthy value to the filter will short-circuit
 retrieving
          * the option value, returning the passed value instead.
          *
          * @since 1.5.0
          * @since 4.4.0 The `$option` parameter was added.
          *
          * @param bool|mixed $pre_option Value to return instead of the
 option value.
          *                               Default false to skip it.
          * @param string     $option     Option name.
          */
         $pre = apply_filters( "pre_option_{$option}", false, $option );
 }}}

 What I believe that is needed here is to add $default as well, which could
 be valuable to the callback hooking in (assuming $default is not false in
 those use cases).

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41254>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list