add_option_whitelist
Adds an array of options to the options whitelist.
Description
Returns (array)
Parameters (2)
- 0. $new_options (array)
- The new options.
- 1. $options — Optional. (string) =>
''
- The options.
Usage
if ( !function_exists( 'add_option_whitelist' ) ) { require_once ABSPATH . '/wp-admin/includes/plugin.php'; } // The new options. $new_options = array(); // The options. $options = ''; // NOTICE! Understand what this does before running. $result = add_option_whitelist($new_options, $options);
Defined (1)
The function is defined in the following location(s).
- /wp-admin/includes/plugin.php
- 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;
- }