Title: Code something only for admin ?
Last modified: August 20, 2016

---

# Code something only for admin ?

 *  [M. Rake](https://wordpress.org/support/users/moriyan-jay/)
 * (@moriyan-jay)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/code-something-only-for-admin/)
 * Hi,
 * I want to display a message in a plugin, if admin is logged in, and another message,
   if anyone else (other than admin) is logged in.
    Can someone please give me idea
   how to code that ? Thanks.

Viewing 1 replies (of 1 total)

 *  [widelegger](https://wordpress.org/support/users/widelegger/)
 * (@widelegger)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/code-something-only-for-admin/#post-2621939)
 * Here you go:
 *     ```
       if (is_user_logged_in() && is_admin() ){
          // here do something for the logged in admin...
       } elseif ( is_user_logged_in() ) {
          // here do something for everyone else who is logged in...
       }
       ```
   
 * These are just a couple native WordPress functions you can use in your own code:
 * [http://codex.wordpress.org/Function_Reference](http://codex.wordpress.org/Function_Reference)

Viewing 1 replies (of 1 total)

The topic ‘Code something only for admin ?’ is closed to new replies.

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 2 participants
 * Last reply from: [widelegger](https://wordpress.org/support/users/widelegger/)
 * Last activity: [14 years, 2 months ago](https://wordpress.org/support/topic/code-something-only-for-admin/#post-2621939)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
