wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



set_user_setting › WordPress Function

Od2.8.0
Przestarzałyn/a
set_user_setting ( $name, $value )
Parametry: (2)
  • (string) $name The name of the setting.
    Wymagane: Tak
  • (string) $value The value for the setting.
    Wymagane: Tak
Powrót:
  • (bool|null) True if set successfully, false otherwise. Null if the current user is not a member of the site.
Zdefiniowane na:
Codex:

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


Źródło

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