[wp-trac] [WordPress Trac] #15335: register_setting() filter for sanitization callback needs to indicate 2 arguments accepted

WordPress Trac wp-trac at lists.automattic.com
Mon Nov 8 01:10:46 UTC 2010


#15335: register_setting() filter for sanitization callback needs to indicate 2
arguments accepted
--------------------------+-------------------------------------------------
 Reporter:  lumination    |       Owner:                  
     Type:  defect (bug)  |      Status:  new             
 Priority:  normal        |   Milestone:  Awaiting Review 
Component:  General       |     Version:  3.1             
 Severity:  normal        |    Keywords:  register_setting
--------------------------+-------------------------------------------------
 '''register_setting()''' adds the function for sanitization of the option
 with the following line (wp-admin/includes/plugin.php):


 {{{
 add_filter( "sanitize_option_{$option_name}", $sanitize_callback );
 }}}

 For users wanting to declare a function for option sanitization, use of
 the option name within the function is sometimes desired, and is provided
 for in the filter application inside the '''sanitize_option()'''
 declaration as such (wp-includes/formatting.php):


 {{{
 $value = apply_filters("sanitize_option_{$option}", $value, $option);
 }}}

 With the filter always being applied with the option name as the second
 argument, I see no reason not to propose that the '''add_filter()''' call
 in register_setting() include "2" as the number of accepted arguments,
 allowing the option name to be passed.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/15335>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list