set_user_setting( string $name, string $value )
Add or update user interface setting.
Description Description
Both $name and $value can contain only ASCII letters, numbers, hyphens, and underscores.
This function has to be used before any output has started as it calls setcookie().
Parameters Parameters
- $name
-
(string) (Required) The name of the setting.
- $value
-
(string) (Required) The value for the setting.
Return Return
(bool|null) True if set successfully, false if not. Null if the current user can't be established.
Source Source
File: wp-includes/option.php
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 ); }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
2.8.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
Override the user setting to always collapse the admin menu for the current user: