WordPress at a glance
function is not described

set_user_setting() WP 2.8.0

Add or update user interface setting.

Both $name and $value can contain only ASCII letters, numbers and underscores.

This function has to be used before any output has started as it calls setcookie().

No Hooks.


true/false/null. True if set successfully, false if not. Null if the current user can't be established.


set_user_setting( $name, $value );
$name(string) (required)
The name of the setting.
$value(string) (required)
The value for the setting.

Code of set user setting: wp-includes/option.php WP 5.2.2

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 );