Created
June 22, 2018 10:48
-
-
Save andrewlimaza/948841d83aa2ed655f1ed9722591034f to your computer and use it in GitHub Desktop.
Give access to membership for all restricted posts.
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 access to all members regardless if they have access to the current post or not. | |
| * Add this code to your PMPro Customizations - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function give_access_to_all_pmpro_members_example( $hasaccess, $thepost, $theuser, $post_membership_levels ) { | |
| if ( pmpro_hasMembershipLevel( array( 7, 8, 9, 10 ) ) ) { | |
| $hasaccess = true; | |
| } | |
| return $hasaccess; | |
| } | |
| add_filter( "pmpro_has_membership_access_filter", "give_access_to_all_pmpro_members_example", 10, 4 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This recipe is included in the blog post on "Unlock Membership Access to All Restricted Content Without Updating Posts" at Paid Memberships Pro here: https://www.paidmembershipspro.com/allow-membership-levels-access-all-restricted-posts/