WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We know, that is_admin() doenst check if user is ADMIN, but it checks only DASHBOARD places...

I use this function to detect if administrator is logged in wordpress:

function iss_admiiiiiin(){
  require_once(ABSPATH.'wp-includes/pluggable.php'); return (current_user_can('create_users')? true:false);

however, does there exist built-in function, like wp_is_admin()?

share|improve this question
if(current_user_can('administrator')) – Howdy_McGee Aug 2 '13 at 17:06
What your code suggests is that you use some kinda bootstrap to laod WP functions outside WP but even in this case you can use what Howdy_McGee says -> see documenation – JMau Aug 2 '13 at 17:19

current_user_can will accept a role name but, sadly, the behavior with roles is not entirely consistent.

The following should work and is simpler than what you have, by a little bit.

$current_user = wp_get_current_user();
if (user_can( $current_user, 'administrator' )) {
  // user is an admin
share|improve this answer
Thanks for link to the ticket. Wasn't aware of that. – Sisir May 16 at 8:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.