set_user_setting
函数
set_user_setting ( $name, $value )
- 参数
-
-
(string)
$name
The name of the setting.- Required: 是
-
(string)
$value
The value for the setting.- Required: 是
-
(string)
- 返回值
-
- (bool|null) True if set successfully, false otherwise. Null if the current user is not a member of the site.
- 定义位置
-
-
wp-includes/option.php
, line 1172
-
wp-includes/option.php
- 引入
- 2.8.0
- 弃用
- –
过滤自定义标识的输出。添加或更新用户界面设置。
`$name`和`$value`都只能包含ASCII字母、数字、连字符和下划线。
这个函数必须在任何输出开始之前使用,因为它调用`setcookie()`。
function set_user_setting( $name, $value ) { if ( headers_sent() ) { return false; } $all_user_settings = get_all_user_settings(); $all_user_settings[ $name ] = $value; return wp_set_all_user_settings( $all_user_settings ); }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。