Skip to content

Instantly share code, notes, and snippets.

@fastmover
Created December 3, 2013 15:47
Show Gist options
  • Save fastmover/7771483 to your computer and use it in GitHub Desktop.
Save fastmover/7771483 to your computer and use it in GitHub Desktop.
Wordpress is lacking an is_subscriber method.
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