unregister_widget_control()
云策文档标注
概述
unregister_widget_control() 是 wp_unregister_widget_control() 的别名函数,用于移除小部件的控制回调,自 WordPress 2.8.0 起已弃用。
关键要点
- 该函数是 wp_unregister_widget_control() 的别名,功能相同。
- 自 WordPress 2.8.0 版本起被弃用,建议直接使用 wp_unregister_widget_control()。
- 接受一个必需参数 $id,类型为 int 或 string,表示小部件的 ID。
- 内部调用 _deprecated_function() 来标记弃用状态。
代码示例
function unregister_widget_control($id) {
_deprecated_function( __FUNCTION__, '2.8.0', 'wp_unregister_widget_control()' );
return wp_unregister_widget_control($id);
}注意事项
在开发中应避免使用此弃用函数,改用 wp_unregister_widget_control() 以确保代码兼容性和最佳实践。
原文内容
Alias of wp_unregister_widget_control() .
Description
See also
Parameters
$idint|stringrequired-
Widget ID.
Source
function unregister_widget_control($id) {
_deprecated_function( __FUNCTION__, '2.8.0', 'wp_unregister_widget_control()' );
return wp_unregister_widget_control($id);
}
Changelog
| Version | Description |
|---|---|
| 2.8.0 | Deprecated. Use wp_unregister_widget_control() |
| 2.2.0 | Introduced. |