Exclude post types from restriction
-
Hi there,
I want to exclude some post types from access restriction without to go into any single post to set this up (sorry, not possible for more than 2000 posts).
I tried this:
add_filter( 'um_custom_restriction', 'exclude_custom_post_types_from_um_restriction', 10, 2 );
function exclude_custom_post_types_from_um_restriction( $custom_restriction, $restriction ) {
if ( is_singular() ) {
$post_type = get_post_type();
$excluded_post_types = array( 'glossary', 'snippet', 'index_tag' );
if ( in_array( $post_type, $excluded_post_types, true ) ) {
return false; // keine UM-Beschränkung
}
}
return $custom_restriction;
}But this isn`t working. Any other ideas?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
The topic ‘Exclude post types from restriction’ is closed to new replies.