Title: add_allowed_options
Published: August 11, 2020
Last modified: February 24, 2026

---

# add_allowed_options( array $new_options, string|array $options ): array

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/add_allowed_options/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/add_allowed_options/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/add_allowed_options/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/add_allowed_options/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/add_allowed_options/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/add_allowed_options/?output_format=md#wp--skip-link--target)

Adds an array of options to the list of allowed options.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/add_allowed_options/?output_format=md#parameters)󠁿

 `$new_options`arrayrequired

`$options`string|arrayrequired

## 󠀁[Return](https://developer.wordpress.org/reference/functions/add_allowed_options/?output_format=md#return)󠁿

 array

## 󠀁[Source](https://developer.wordpress.org/reference/functions/add_allowed_options/?output_format=md#source)󠁿

    ```php
    function add_allowed_options( $new_options, $options = '' ) {
    	if ( '' === $options ) {
    		global $allowed_options;
    	} else {
    		$allowed_options = $options;
    	}

    	foreach ( $new_options as $page => $keys ) {
    		foreach ( $keys as $key ) {
    			if ( ! isset( $allowed_options[ $page ] ) || ! is_array( $allowed_options[ $page ] ) ) {
    				$allowed_options[ $page ]   = array();
    				$allowed_options[ $page ][] = $key;
    			} else {
    				$pos = array_search( $key, $allowed_options[ $page ], true );
    				if ( false === $pos ) {
    					$allowed_options[ $page ][] = $key;
    				}
    			}
    		}
    	}

    	return $allowed_options;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-admin/includes/plugin.php#L2302)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-admin/includes/plugin.php#L2302-L2324)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/add_allowed_options/?output_format=md#related)󠁿

| Used by | Description | 
| [option_update_filter()](https://developer.wordpress.org/reference/functions/option_update_filter/)`wp-admin/includes/plugin.php` |

Refreshes the value of the allowed options list available via the ‘allowed_options’ hook.

  | 
| [add_option_whitelist()](https://developer.wordpress.org/reference/functions/add_option_whitelist/)`wp-includes/deprecated.php` |

Adds an array of options to the list of allowed options.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/add_allowed_options/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fadd_allowed_options%2F)
before being able to contribute a note or feedback.