Function: get_user_option

get_user_option( string $option, integer $user, string $deprecated )

Retrieve user option that can be either per Site or per Network.

Shortcut: guo

You can use above key combination to trigger the associated snippet for this function in the WordPress Snippets for Visual Studio Code extension. You can also use this shortcut to search for this function on this website.

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.

The option will first check for the per site name and then the per Network name.

Parameters

Name Type(s) Default Value Description
$option string

User option name.

$user integer

Optional. User ID.

$deprecated string ''

Use get_option() to check for an option in the options table.

Returns

mixed

User option value on success, false on failure.

WordPress Developer Newsletter

Stay informed of new chapter releases, important WordPress API updates and more.