Definition:
function register_setting( $option_group, $option_name, $sanitize_callback = '' ) {}
Register a setting and its sanitization callback
Parameters
- string $option_group: A settings group name. Should correspond to a whitelisted option key name. Default whitelisted option key names include “general,” “discussion,” and “reading,” among others.
- string $option_name: The name of an option to sanitize and save.
- unknown_type $sanitize_callback: A callback function that sanitizes the option’s value.
Source code
function register_setting( $option_group, $option_name, $sanitize_callback = '' ) {
global $new_whitelist_options;
if ( 'misc' == $option_group ) {
_deprecated_argument( __FUNCTION__, '3.0', __( 'The miscellaneous options group has been removed. Use another settings group.' ) );
$option_group = 'general';
}
$new_whitelist_options[ $option_group ][] = $option_name;
if ( $sanitize_callback != '' )
add_filter( "sanitize_option_{$option_name}", $sanitize_callback );
2677

February 12, 2011 


No comments yet... Be the first to leave a reply!