Forked from strangerstudios/my_pmpro_has_membership_access_filter.php
Last active
December 20, 2021 21:15
-
-
Save kimwhite/eaebbf47ccc54a5d2aad1359af1976f2 to your computer and use it in GitHub Desktop.
Have a Paid Memberships Pro level with access to EVERYTHING for multiple levels
This file contains hidden or 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 | |
/* | |
Give level 1 members access to everything. | |
Add this to your active theme's functions.php or a custom plugin. | |
*/ | |
function my_pmpro_has_membership_access_filter($access, $post, $user) | |
{ | |
if(!empty($user->membership_level) && in_array( $user->membership_level->ID, array( 12, 14 ) ) ) | |
return true; //level 1 ALWAYS has access | |
return $access; | |
} | |
add_filter("pmpro_has_membership_access_filter", "my_pmpro_has_membership_access_filter", 10, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment