Skip to content

Instantly share code, notes, and snippets.

@mikeyarce
Created September 28, 2016 22:43
Show Gist options
  • Save mikeyarce/bf9600a373ea21493c23f665af5e6851 to your computer and use it in GitHub Desktop.
Save mikeyarce/bf9600a373ea21493c23f665af5e6851 to your computer and use it in GitHub Desktop.
WooCommerce Memberships restrict through template
<?php
$user_id = get_current_user_id();
if ( wc_memberships_is_user_active_member( $user_id, 'gold' ) ) {
get_template_part( 'template', 'gold' );
} else {
echo "You are not allowed to view this content";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment