Advertisements

Determine if current user is an admin in WordPress using PHP

You can determine if the current logged-in WordPress user is an admin and take a certain action in WordPress using PHP. If you’re using a PHP widget plugin, you can use this code in a PHP widget to show or do something if the current user is an admin. You can also use this to limit the display of a block you might be working on to only admin users while you’re working on it.


This method is ideal because only admins have the manage_options capability.

Comments are welcome below. Thank you.

Advertisements

,