Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



set_user_setting ›

Seit2.8.0
Veraltetn/v
set_user_setting ( $name, $value )
Parameter: (2)
  • (string) $name The name of the setting.
    Erforderlich: Ja
  • (string) $value The value for the setting.
    Erforderlich: Ja
Gibt zurück:
  • (bool|null) True if set successfully, false if not. Null if the current user can't be established.
Definiert in:
Codex:

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



Quellcode

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