WordPress功能函数add_allowed_options()
WordPress功能函数add_allowed_options(),向允许的选项列表中添加选项数组。
add_allowed_options( array $new_options, string|array $options = ” )
参数:
$new_options
(array) (必需)
$options
(string|array) (可选)
默认值: ”
返回:
(数组)
来源:
文件: wp-admin/includes/plugin.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;
}