get_user_option_<option>

Filters a specific user option value.

Description

apply_filters( 'get_user_option_<option>', (mixed) $result, (string) $option, (WP_User) $user ); 

The dynamic portion(s) of the hook name refer to the user option name.

Parameters (3)

0. $result (mixed)
Value for the user's option.
1. $option (string)
Name of the option being retrieved.
2. $user (WP_User)
WP_User object of the user whose option is being retrieved.

Usage

To run the hook, copy the example below.
  1. $result = apply_filters( 'get_user_option_{$option}', $result, $option, $user ); 
  2.  
  3. if ( !empty( $result ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the get_user_option_<option> callback 
  2. function filter_get_user_option_option( $result, $option, $user ) { 
  3. // make filter magic happen here... 
  4. return $result
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( "get_user_option_{$option}", 'filter_get_user_option_option', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( "get_user_option_{$option}", 'filter_get_user_option_option', 10, 3 ); 

Defined (1)

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

/wp-includes/user.php  
  1. return apply_filters( "get_user_option_{$option}", $result, $option, $user );