A WordPress-centric search engine for devs and theme authors



add_option_whitelist ›

Since2.7.0
Deprecatedn/a
add_option_whitelist ( $new_options, $options = '' )
Parameters: (2)
  • (array) $new_options
    Required: Yes
  • (string|array) $options
    Required: No
    Default: (empty)
Returns:
  • (array)
Defined at:
Codex:

Adds an array of options to the options whitelist.



Source

function add_option_whitelist( $new_options, $options = '' ) {
	if ( $options == '' )
		global $whitelist_options;
	else
		$whitelist_options = $options;

	foreach ( $new_options as $page => $keys ) {
		foreach ( $keys as $key ) {
			if ( !isset($whitelist_options[ $page ]) || !is_array($whitelist_options[ $page ]) ) {
				$whitelist_options[ $page ] = array();
				$whitelist_options[ $page ][] = $key;
			} else {
				$pos = array_search( $key, $whitelist_options[ $page ] );
				if ( $pos === false )
					$whitelist_options[ $page ][] = $key;
			}
		}
	}

	return $whitelist_options;
}