add_option_whitelist

The timeline below displays how wordpress function add_option_whitelist has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.5

/**
 * Adds an array of options to the list of allowed options.
 *
 * @since 2.7.0
 * @deprecated 5.5.0 Use add_allowed_options() instead.
 *                   Please consider writing more inclusive code.
 *
 * @param array        $new_options
 * @param string|array $options
 * @return array
 */
function add_option_whitelist($new_options, $options = '')
{
    _deprecated_function(__FUNCTION__, '5.5.0', 'add_allowed_options()');
    return add_allowed_options($new_options, $options);
}

WordPress Version: 5.5

/**
 * Adds an array of options to the list of allowed options.
 *
 * @since 2.7.0
 * @deprecated 5.5.0 Use add_allowed_options() instead.
 *                   Please consider writing more inclusive code.
 *
 * @global array $allowed_options
 *
 * @param array        $new_options
 * @param string|array $options
 * @return array
 */
function add_option_whitelist($new_options, $options = '')
{
    _deprecated_function(__FUNCTION__, '5.5.0', 'add_allowed_options()');
    return add_allowed_options($new_options, $options);
}

WordPress Version: 5.4

/**
 * Adds an array of options to the options whitelist.
 *
 * @since 2.7.0
 *
 * @global array $whitelist_options
 *
 * @param array        $new_options
 * @param string|array $options
 * @return array
 */
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 (false === $pos) {
                    $whitelist_options[$page][] = $key;
                }
            }
        }
    }
    return $whitelist_options;
}

WordPress Version: 4.4

/**
 * Adds an array of options to the options whitelist.
 *
 * @since 2.7.0
 *
 * @global array $whitelist_options
 *
 * @param array        $new_options
 * @param string|array $options
 * @return array
 */
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;
}

WordPress Version: 4.3

/**
 * {@internal Missing Short Description}}
 *
 * @since 2.7.0
 *
 * @global array $whitelist_options
 *
 * @param array        $new_options
 * @param string|array $options
 * @return array
 */
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;
}

WordPress Version: 4.1

/**
 * {@internal Missing Short Description}}
 *
 * @since 2.7.0
 *
 * @param array        $new_options
 * @param string|array $options
 * @return array
 */
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;
}

WordPress Version: 3.7

/**
 * {@internal Missing Short Description}}
 *
 * @since 2.7.0
 *
 * @param unknown_type $new_options
 * @param unknown_type $options
 * @return unknown
 */
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;
}