• I’m looking to add a link to wp-admin for users that are Editors. I know anyone can just type in wp-admin and log in if they want however I want all my editors to be shown a link to wp-admin in their profile.

    So atop their profile or possibly in the footer there will be something like:

    If (user=editor) {
    <h3>Your Profile | <a href="/wp-admin/">Admin Page</a></h3>;
    }
    else <h3>Your Profile</h3>;

    However I don’t know what code I need in place of the ‘user=editor’

Viewing 1 replies (of 1 total)
  • Thread Starter Deewon

    (@deewon)

    After some research I found its simpler to call their capability than role. So best way is to pick something the role can do then call that. I also decided to allow contributors so I went for ‘edit_posts’.

    if( current_user_can( 'edit_posts' ) ) {
    <h3>Your Profile | <a href="/wp-admin/">Admin Page</a></h3>;
    }
    else <h3>Your Profile</h3>;
Viewing 1 replies (of 1 total)
  • The topic ‘If user is Editor then….’ is closed to new replies.