Online Forum To Support Coders With Technical Assistance - Read Write Execute

How to get current user role in wordpress

Ankit Agrawal
Ankit Agrawal
Published on July 30, 2015 · 1 min read
$aUserId = get_current_user_id(); 
$aUser = new WP_User( $aUserId ); 
$aRole = $aUser->roles[0];
Was this article helpful?
Ankit Agrawal

Ankit Agrawal

Author & Senior Engineer at CodeExecute

Writing practical engineering guides, debugging real-world bottlenecks, and creating free tools for developer productivity.

← Previous Article How to remove php extension from url Next Article → How to find HTML Elements using JavaScript?