-
-
Save grayayer/f853dfc42be776e6528a6f3d24f6c15b to your computer and use it in GitHub Desktop.
WooCommerce Memberships restriction on a page through using a template. This is how we can easily do it for pages that aren't generated through a post, like the Events Calendar archive
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
<?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