Uma área de pesquisa sobre o WordPress para devs e autores do tema



set_user_setting ›

Desde2.8.0
Obsoleton/a
set_user_setting ( $name, $value )
Parâmetros: (2)
  • (string) $name The name of the setting.
    Required: Yes
  • (string) $value The value for the setting.
    Required: Yes
Retorna:
  • (bool|null) True if set successfully, false if not. Null if the current user can't be established.
Definido em:
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().



Fonte

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