Codex tools: Log in
Contents |
Retrieve user option that can be either global, user, or blog.
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 non-global name, then the global name, and if it still doesn't find it, it will try the blog option. The option can either be modified or set by a plugin.
<?php get_user_option( $option, $user ) ?>
<?php
$bar = get_user_option( 'show_admin_bar_front', get_current_user_id() );
if( $bar == 'true' ) {
echo 'The admin bar is enabled';
} else {
echo 'The admin bar is disabled';
}
?>
Since: 2.0.0
get_user_option() is located in wp-includes/user.php.