Make WordPress Core

Ticket #14149: 141419-2.diff

File 141419-2.diff, 964 bytes (added by blepoxp, 15 years ago)

Takes a mixed array to allow some options have callbacks while others dont'

  • wp-admin/includes/plugin.php

     
    14861486}
    14871487
    14881488/**
     1489 * Register settings and a sanitization callback
     1490 *
     1491 * @since 3.1.0
     1492 *
     1493 * @param string $option_group A settings group name.  Should correspond to a whitelisted option key name.
     1494 *      Default whitelisted option key names include "general," "discussion," and "reading," among others.
     1495 * @param array $options Option names to sanitize and save. If keyed as option names, the value would be
     1496 *      the sanitization callback.
     1497 
     1498 */
     1499function register_settings( $option_group, $options ) {
     1500        foreach ( $options as $key => $value ){
     1501                if ( is_integer( $key ) )
     1502                        register_setting( $option_group, $value );
     1503                else
     1504                        register_setting( $option_group, $key, $value );
     1505        }
     1506}
     1507
     1508/**
    14891509 * Unregister a setting
    14901510 *
    14911511 * @since 2.7.0