向选项白名单添加一系列选项。

原型

add_option_whitelist( array $new_options, string|array $options = '' )

参数

$new_options (array) (Required)

$options (string|array) (Optional)

返回值

(array)  

源文件

路径:wp-admin/includes/plugin.php

<?php
...
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;
}
...
?>

其他

英文文档:https://developer.wordpress.org/reference/functions/add_option_whitelist/