Check user role

Sometimes you might want to know what role a user have, for example if you only want certain links(like edit etc) to be displayed for authors and not for visitors.

The function current_user_can() does just that. See the examples below:

There is a ton of different capabilities you can check for, and they are all found in the documentation.

Comments  Leave a Reply

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!