WordPress.org

Ready to get started?Download WordPress

Forums

If user is logged in and an admin (show this) else (2 posts)

  1. Scott.Reinmuth
    Member
    Posted 1 year ago #

    The code I am using is not working. I want it to echo dashboard if an admin or author is logged in and I want it to show profile if a normal user is logged in. This is the code I have so far...

    <?php
    if ( is_user_logged_in() && current_user_can( 'Administrator' ) ) {
        echo '<a href="">Dashboard</a>';
    } else {
        echo '<a href="/login">Login</a>';
    }
    ?>

    This is the start for if an admin logs in. What am I doing wrong?

    See my navigation at Scottreinmuth.com for a better understanding

  2. bcworkz
    Member
    Posted 1 year ago #

    To control what happens when a user logs in, start with Plugin API/Filter Reference/login redirect

Topic Closed

This topic has been closed to new replies.

About this Topic