WordPress.org

Ready to get started?Download WordPress

Forums

Code something only for admin ? (2 posts)

  1. Moriyan Sharma
    Member
    Posted 2 years ago #

    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.

  2. widelegger
    Member
    Posted 2 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.