Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
add body class if current user is subscriber
add_filter( 'body_class', 'add_class_if_subscriber' );
function add_class_if_subscriber( $classes ) {
$user_ID = get_current_user_id();
$subscriber = mailster('subscribers')->get_by_wpid($user_ID);
if($subscriber){
$classes[] = 'is-mailster-subscriber';
}
return $classes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment