(array) (Required)
(string|array) (Optional)
Default value: ”
Syntax:
1 |
add_option_whitelist( array $new_options, string|array $options = '' ) |
The function is defined in the following location(s).
/wp-admin/includes/plugin.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
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; } |
Examples 1: add_option_whitelist() function:
1 2 3 4 5 6 7 8 9 10 11 12 |
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); |
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.