Skip to content

Instantly share code, notes, and snippets.

@kimcoleman
Created December 27, 2018 18:52
Show Gist options
  • Save kimcoleman/2959907b57d213272de1a5471cf9edaa to your computer and use it in GitHub Desktop.
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.
<?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