Filter hook 'get_user_option_{$option}'

in WP Core File wp-includes/user.php at line 772

View Source

get_user_option_{$option}

Filter Hook
Description
Filters a specific user option value. The dynamic portion of the hook name, `$option`, refers to the user option name.

Hook Information

File Location wp-includes/user.php View on GitHub
Hook Type Filter
Line Number 772

Hook Parameters

Type Name Description
mixed $result Value for the user's option.
string $option Name of the option being retrieved.
WP_User $user WP_User object of the user whose option is being retrieved.

Usage Examples

Basic Usage
<?php
// Hook into get_user_option_{$option}
add_filter('get_user_option_{$option}', 'my_custom_filter', 10, 3);

function my_custom_filter($result, $option, $user) {
    // Your custom filtering logic here
    return $result;
}

Source Code Context

wp-includes/user.php:772 - How this hook is used in WordPress core
<?php
 767  	 *
 768  	 * @param mixed   $result Value for the user's option.
 769  	 * @param string  $option Name of the option being retrieved.
 770  	 * @param WP_User $user   WP_User object of the user whose option is being retrieved.
 771  	 */
 772  	return apply_filters( "get_user_option_{$option}", $result, $option, $user );
 773  }
 774  
 775  /**
 776   * Updates user option with global blog capability.
 777   *

PHP Documentation

<?php
/**
	 * Filters a specific user option value.
	 *
	 * The dynamic portion of the hook name, `$option`, refers to the user option name.
	 *
	 * @since 2.5.0
	 *
	 * @param mixed   $result Value for the user's option.
	 * @param string  $option Name of the option being retrieved.
	 * @param WP_User $user   WP_User object of the user whose option is being retrieved.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/user.php
Related Hooks

Related hooks will be displayed here in future updates.