get_user_setting

Retrieve user interface setting value based on setting name.

Description

get_user_setting( (string) $name, (bool) $default = false ); 

Parameters (2)

0. $name (string)
The name of the setting.
1. $default — Optional. (bool) => false
Default value to return when $name is not set.

Usage

  1. if ( !function_exists( 'get_user_setting' ) ) { 
  2. require_once ABSPATH . WPINC . '/option.php'; 
  3.  
  4. // The name of the setting. 
  5. $name = ''; 
  6.  
  7. // Optional default value to return when $name is not set. 
  8. $default = false; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = get_user_setting($name, $default); 
  12.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/option.php  
  1. function get_user_setting( $name, $default = false ) { 
  2. $all_user_settings = get_all_user_settings(); 
  3.  
  4. return isset( $all_user_settings[$name] ) ? $all_user_settings[$name] : $default;