Created
December 3, 2013 15:47
-
-
Save fastmover/7771483 to your computer and use it in GitHub Desktop.
Wordpress is lacking an is_subscriber method.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function is_subscriber() { | |
// Test if role is subscriber | |
$cu = wp_get_current_user(); | |
if (!empty($cu->roles) && is_array($cu->roles)) { | |
if(in_array('subscriber', $cu->roles)) { | |
return true; | |
} | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment