WordPress: If admin or editor logged in

Last updated on

If user logged in and has admin rights

if (current_user_can('administrator')) { 
    echo "admin logged in";
}

If user logged in and has editor rights

if (current_user_can('editor')) { 
    echo "editor logged in";
}

Let me know if this helped. Follow me on Twitter, Facebook and YouTube, or 🍊 buy me a smoothie.

Leave a reply

Your email address will not be published. Required fields are marked *