WordPress.org

Make WordPress Core

Ticket #15335: 15335_params.diff

File 15335_params.diff, 1.1 KB (added by ejdanderson, 10 years ago)

Filter args as optional parameters.

  • plugin.php

     
    15931593 *      Default whitelisted option key names include "general," "discussion," and "reading," among others.
    15941594 * @param string $option_name The name of an option to sanitize and save.
    15951595 * @param unknown_type $sanitize_callback A callback function that sanitizes the option's value.
     1596 * @param int $priority priority for callback filter
     1597 * @param int $accepted_args accepted args in callback
    15961598 * @return unknown
    15971599 */
    1598 function register_setting( $option_group, $option_name, $sanitize_callback = '' ) {
     1600function register_setting( $option_group, $option_name, $sanitize_callback = '', $priority = 10, $accepted_args = 1 ) {
    15991601        global $new_whitelist_options;
    16001602
    16011603        if ( 'misc' == $option_group ) {
     
    16051607
    16061608        $new_whitelist_options[ $option_group ][] = $option_name;
    16071609        if ( $sanitize_callback != '' )
    1608                 add_filter( "sanitize_option_{$option_name}", $sanitize_callback );
     1610                add_filter( "sanitize_option_{$option_name}", $sanitize_callback, $priority, $accepted_args );
    16091611}
    16101612
    16111613/**