Created
December 12, 2023 13:38
-
-
Save plugin-republic/56aab86857a7c1fc41f6360c87ecf304 to your computer and use it in GitHub Desktop.
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 | |
/** | |
* Filter restriction by page ID for user roles | |
*/ | |
function prefix_is_restricted_redirect( $is_restricted ) { | |
$restricted_page_ids = array( 2, 10 ); | |
if( is_page() ) { | |
$page_id = get_the_ID(); | |
if( in_array( $page_id, $restricted_page_ids ) ) { | |
$is_permitted_user_role = wcmo_is_permitted_user_role(); | |
if( ! wcmo_is_permitted_user_role() ) { | |
$is_restricted = true; | |
} | |
} | |
} | |
return $is_restricted; | |
} | |
add_filter( 'wcmo_is_restricted_redirect', 'prefix_is_restricted_redirect', 10 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment