unregister_setting()
unregister_setting( string $option_group, string $optio…
unregister_setting( string $option_group, string $option_name, callable $deprecated = ” )
取消注册设置。
Unregisters a setting.
目录锚点:#参数#源码
参数(Parameters)
| 参数 | 类型 | 说明 |
|---|---|---|
| $option_group | (string) | 注册期间使用的设置组名称。 |
| $option_name | (string) | 要注销的选项的名称。 |
| $deprecated | (callable) | 已弃用。 |
源码(Source)
/**
* Unregister a setting
*
* @since 2.7.0
*
* @global array $new_whitelist_options
*
* @param string $option_group
* @param string $option_name
* @param callable $sanitize_callback
*/
function unregister_setting( $option_group, $option_name, $sanitize_callback = '' ) {
global $new_whitelist_options;
if ( 'misc' == $option_group ) {
_deprecated_argument( __FUNCTION__, '3.0', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'misc' ) );
$option_group = 'general';
}
if ( 'privacy' == $option_group ) {
_deprecated_argument( __FUNCTION__, '3.5', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'privacy' ) );
$option_group = 'reading';
}
$pos = array_search( $option_name, (array) $new_whitelist_options[ $option_group ] );
if ( $pos !== false )
unset( $new_whitelist_options[ $option_group ][ $pos ] );
if ( $sanitize_callback != '' )
remove_filter( "sanitize_option_{$option_name}", $sanitize_callback );
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 4.7.0 | wp-includes/option.php | 3 | 14 |
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。





还没有任何评论,赶紧来占个楼吧!