function get_user_option( $option, $user = 0, $deprecated = '' ) {}

Retrieve user option that can be either per Site or per Network.
If the user ID is not given, then the current user will be used instead. If the user ID is given, then the user data will be retrieved. The filter for the result, will also pass the original option name and finally the user data object as the third parameter.


  • string $option: User option name.
  • int $user: Optional. User ID.
  • bool $deprecated: Use get_option() to check for an option in the options table.

Defined filters

  • get_user_option_{$option}
    apply_filters("get_user_option_{$option}", $result, $option, $user)

Source code

function get_user_option( $option, $user = 0, $deprecated = '' ) {

	global $wpdb;

	if ( !empty( $deprecated ) )

		_deprecated_argument( __FUNCTION__, '3.0' );

	if ( empty( $user ) )

		$user = wp_get_current_user();


		$user = new WP_User( $user );

	if ( ! isset( $user->ID ) )

		return false;

	if ( $user->has_prop( $wpdb->prefix . $option ) ) // Blog specific

		$result = $user->get( $wpdb->prefix . $option );

	elseif ( $user->has_prop( $option ) ) // User specific and cross-blog

		$result = $user->get( $option );


		$result = false;

	return apply_filters("get_user_option_{$option}", $result, $option, $user);


No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: