get_all_user_settings

Retrieve all user interface settings.

Description

(array) get_all_user_settings(); 

Returns (array)

the last saved user settings or empty array.


Usage

  1. if ( !function_exists( 'get_all_user_settings' ) ) { 
  2. require_once ABSPATH . WPINC . '/option.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = get_all_user_settings(); 
  7.  

Defined (1)

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

/wp-includes/option.php  
  1. function get_all_user_settings() { 
  2. global $_updated_user_settings; 
  3.  
  4. if ( ! $user_id = get_current_user_id() ) { 
  5. return array(); 
  6.  
  7. if ( isset( $_updated_user_settings ) && is_array( $_updated_user_settings ) ) { 
  8. return $_updated_user_settings; 
  9.  
  10. $user_settings = array(); 
  11.  
  12. if ( isset( $_COOKIE['wp-settings-' . $user_id] ) ) { 
  13. $cookie = preg_replace( '/[^A-Za-z0-9=&_-]/', '', $_COOKIE['wp-settings-' . $user_id] ); 
  14.  
  15. if ( strpos( $cookie, '=' ) ) { // '=' cannot be 1st char 
  16. parse_str( $cookie, $user_settings ); 
  17. } else { 
  18. $option = get_user_option( 'user-settings', $user_id ); 
  19.  
  20. if ( $option && is_string( $option ) ) { 
  21. parse_str( $option, $user_settings ); 
  22.  
  23. $_updated_user_settings = $user_settings; 
  24. return $user_settings;