[wp-trac] [WordPress Trac] #29193: Settings sanitize callback - $option arg is not available

WordPress Trac noreply at wordpress.org
Tue Aug 12 14:17:08 UTC 2014


#29193: Settings sanitize callback - $option arg is not available
--------------------------------+------------------------
 Reporter:  dashaluna           |       Owner:
     Type:  enhancement         |      Status:  closed
 Priority:  normal              |   Milestone:
Component:  Options, Meta APIs  |     Version:  trunk
 Severity:  normal              |  Resolution:  duplicate
 Keywords:  has-patch           |     Focuses:
--------------------------------+------------------------
Changes (by SergeyBiryukov):

 * status:  new => closed
 * resolution:   => duplicate
 * component:  General => Options, Meta APIs
 * milestone:  Awaiting Review =>


Old description:

> If you register a setting and specify a sanitize callback, the option
> name argument is not available in the callback function.
>
> See wp-includes/formatting.php line 3432 - where WordPress applys the
> santiization filters.
>
>     $value = apply_filters( "sanitize_option_{$option}", $value, $option
> );
>
> It passes as second arg of $option, but when registering as setting - the
> sanitization callback is added to this filter, but the number of accepted
> args is not specified when adding the filter.

New description:

 If you register a setting and specify a sanitize callback, the option name
 argument is not available in the callback function.

 See wp-includes/formatting.php line 3432 - where WordPress applys the
 santiization filters.
 {{{
     $value = apply_filters( "sanitize_option_{$option}", $value, $option
 );
 }}}
 It passes as second arg of $option, but when registering as setting - the
 sanitization callback is added to this filter, but the number of accepted
 args is not specified when adding the filter.

--

Comment:

 Duplicate of #15335.

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


More information about the wp-trac mailing list