Title: Getting User Level
Last modified: August 18, 2016

---

# Getting User Level

 *  [Vladimir Prelovac](https://wordpress.org/support/users/freediver/)
 * (@freediver)
 * [18 years, 5 months ago](https://wordpress.org/support/topic/getting-user-level/)
 * I am writing a plugin that displays content only to admin user. To test if admin
   is logged in I trued using $user_level but the value I get is 0 instead of 10.
 * This code:
    get_currentuserinfo() ; global $user_level; echo ‘user level: ‘.$
   user_level;
 * Will echo out 0 when admin is logged in.
 * What am I doing wrong?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [18 years, 5 months ago](https://wordpress.org/support/topic/getting-user-level/#post-660437)
 * Works fine for me.
 * Note get_currentuserinfo() is not necessary; $user_level will already be available
   as a global var in the admin pages.
 *  Thread Starter [Vladimir Prelovac](https://wordpress.org/support/users/freediver/)
 * (@freediver)
 * [18 years, 5 months ago](https://wordpress.org/support/topic/getting-user-level/#post-660440)
 * It is not working for me.. But anyways, I just discovered I should be using
 * current_user_can(‘level_10’)
 * for the same task.
 * If I display all roles with wp_dropdown_roles() and user picks one (for example‘
   editor’) how can I check later if the current user is ‘editor’?
 *  Thread Starter [Vladimir Prelovac](https://wordpress.org/support/users/freediver/)
 * (@freediver)
 * [18 years, 5 months ago](https://wordpress.org/support/topic/getting-user-level/#post-660496)
 * Anyone please?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Getting User Level’ is closed to new replies.

## Tags

 * [admin](https://wordpress.org/support/topic-tag/admin/)
 * [user-level](https://wordpress.org/support/topic-tag/user-level/)
 * [user-rights](https://wordpress.org/support/topic-tag/user-rights/)

 * 3 replies
 * 2 participants
 * Last reply from: [Vladimir Prelovac](https://wordpress.org/support/users/freediver/)
 * Last activity: [18 years, 5 months ago](https://wordpress.org/support/topic/getting-user-level/#post-660496)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
