get_user_setting() WordPress Function

The get_user_setting() function is used to get the value of a user setting from the current user's meta data.

get_user_setting( string $name, string|false $default = false ) #

Retrieves user interface setting value based on setting name.


Parameters

$name

(string)(Required)The name of the setting.

$default

(string|false)(Optional) Default value to return when $name is not set.

Default value: false


Top ↑

Return

(mixed) The last saved user setting or the default value/false if it doesn't exist.


Top ↑

Source

File: wp-includes/option.php

function get_user_setting( $name, $default = false ) {
	$all_user_settings = get_all_user_settings();

	return isset( $all_user_settings[ $name ] ) ? $all_user_settings[ $name ] : $default;
}


Top ↑

Changelog

Changelog
VersionDescription
2.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More