-
-
Save andrewlimaza/ae0248614e5f7a8731054a2580b58f8c to your computer and use it in GitHub Desktop.
Give user access to post or page dynamically for Addon Packages All Access filter
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 | |
/** | |
* Give access to a certain post/page for specific users. | |
* Please add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmproap_all_access_levels($levels, $user_id, $post_id) { | |
if ( $post_id == 71 && $user_id == 1 ) { // Change post ID and user ID value. Adjust this accordingly. | |
$levels = array('4'); | |
} | |
return $levels; | |
} | |
add_filter( 'pmproap_all_access_levels', 'my_pmproap_all_access_levels', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment