remove_allowed_options

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

WordPress Version: 5.5

/**
 * Removes a list of options from the allowed options list.
 *
 * @since 5.5.0
 *
 * @global array $allowed_options
 *
 * @param array        $del_options
 * @param string|array $options
 * @return array
 */
function remove_allowed_options($del_options, $options = '')
{
    if ('' === $options) {
        global $allowed_options;
    } else {
        $allowed_options = $options;
    }
    foreach ($del_options as $page => $keys) {
        foreach ($keys as $key) {
            if (isset($allowed_options[$page]) && is_array($allowed_options[$page])) {
                $pos = array_search($key, $allowed_options[$page], true);
                if (false !== $pos) {
                    unset($allowed_options[$page][$pos]);
                }
            }
        }
    }
    return $allowed_options;
}