set_user_setting() – Add or update user interface setting.

You appear to be a bot. Output may be restricted

Description

Adds or updates user interface setting.

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().

Usage

$bool|null = set_user_setting( $name, $value );

Parameters

$name
( string ) required – The name of the setting.
$value
( string ) required – The value for the setting.

Returns

bool|null True if set successfully, false otherwise. Null if the current user is not a member of the site.

Source

File name: wordpress/wp-includes/option.php
Lines:

1 to 10 of 10
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 );
}
 

 View on GitHub View on Trac