remove_option_whitelist()
云策文档标注
概述
remove_option_whitelist() 是一个已弃用的 WordPress 函数,用于从允许选项列表中移除指定选项。自 WordPress 5.5.0 起,建议使用 remove_allowed_options() 替代。
关键要点
- 函数 remove_option_whitelist() 已弃用,自版本 5.5.0 起应改用 remove_allowed_options()。
- 该函数接受两个参数:$del_options(必需,数组)和 $options(必需,字符串或数组),用于指定要移除的选项列表。
- 函数返回一个数组,表示移除后的允许选项列表。
- 相关函数包括 remove_allowed_options() 和 _deprecated_function(),后者用于标记函数为弃用状态。
注意事项
在开发中,应避免使用此弃用函数,以保持代码的兼容性和遵循 WordPress 最佳实践。
原文内容
Removes a list of options from the allowed options list.
Parameters
$del_optionsarrayrequired$optionsstring|arrayrequired
Source
function remove_option_whitelist( $del_options, $options = '' ) {
_deprecated_function( __FUNCTION__, '5.5.0', 'remove_allowed_options()' );
return remove_allowed_options( $del_options, $options );
}
Changelog
| Version | Description |
|---|---|
| 5.5.0 | Deprecated. Use remove_allowed_options() instead. Please consider writing more inclusive code. |
| 2.7.0 | Introduced. |