WordPress at Your Fingertips
function is not described

remove_allowed_options() WP 5.5.0

Removes a list of options from the allowed options list.

No Hooks.

Return

Array.

Usage

remove_allowed_options( $del_options, $options );
$del_options(array) (required)
-
$options *(string array)*

Default: ''

Notes

  • Global. Array. $allowed_options

Changelog

Since 5.5.0 Introduced.

Code of remove_allowed_options() WP 5.8.2

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;
}