If the current user is an administrator or editor

Posted by Editorial Staff | Updated on

Question: How can I check to see if the current logged-in user is an administrator or an editor?

Answer: In this example, we have used “OR” operator to check logic. Below is an example:

If you want to check more than two roles, you can check if the roles of the current user is inside an array of roles, something like:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers