delete_user_setting
函数
delete_user_setting ( $names )
- 参数
-
-
(string)
$names
The name or array of names of the setting to be deleted.- Required: 是
-
(string)
- 返回值
-
- (bool|null) True if deleted successfully, false otherwise. Null if the current user is not a member of the site.
- 定义位置
-
-
wp-includes/option.php
, line 1196
-
wp-includes/option.php
- 引入
- 2.7.0
- 弃用
- –
Deletes user interface settings.
Deleting settings would reset them to the defaults.
This function has to be used before any output has started as it calls `setcookie()`.
function delete_user_setting( $names ) { if ( headers_sent() ) { return false; } $all_user_settings = get_all_user_settings(); $names = (array) $names; $deleted = false; foreach ( $names as $name ) { if ( isset( $all_user_settings[ $name ] ) ) { unset( $all_user_settings[ $name ] ); $deleted = true; } } if ( $deleted ) { return wp_set_all_user_settings( $all_user_settings ); } return false; }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。