add_option_whitelist

Adds an array of options to the options whitelist.

Description

(array) add_option_whitelist( (array) $new_options, (string) $options = '' ); 

Returns (array)

Parameters (2)

0. $new_options (array)
The new options.
1. $options — Optional. (string) => ''
The options.

Usage

  1. if ( !function_exists( 'add_option_whitelist' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/plugin.php'; 
  3.  
  4. // The new options. 
  5. $new_options = array(); 
  6.  
  7. // The options. 
  8. $options = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = add_option_whitelist($new_options, $options); 
  12.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/plugin.php  
  1. function add_option_whitelist( $new_options, $options = '' ) { 
  2. if ( $options == '' ) 
  3. global $whitelist_options; 
  4. else 
  5. $whitelist_options = $options; 
  6.  
  7. foreach ( $new_options as $page => $keys ) { 
  8. foreach ( $keys as $key ) { 
  9. if ( !isset($whitelist_options[ $page ]) || !is_array($whitelist_options[ $page ]) ) { 
  10. $whitelist_options[ $page ] = array(); 
  11. $whitelist_options[ $page ][] = $key; 
  12. } else { 
  13. $pos = array_search( $key, $whitelist_options[ $page ] ); 
  14. if ( $pos === false ) 
  15. $whitelist_options[ $page ][] = $key; 
  16.  
  17. return $whitelist_options;