Created
December 27, 2018 18:52
-
-
Save kimcoleman/2959907b57d213272de1a5471cf9edaa to your computer and use it in GitHub Desktop.
Execute custom code if the user does not have access to the content.
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 | |
/* | |
* Execute custom code if the user does not have access to the content. | |
*/ | |
$queried_object = get_queried_object(); | |
if ( | |
function_exists( 'pmpro_has_membership_access' ) && | |
! empty( $queried_object ) && | |
empty( pmpro_has_membership_access( $queried_object->ID, NULL, false ) ) | |
) { | |
// Execute custom code here for users without access. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment