Created
September 26, 2023 22:49
-
-
Save greenhornet79/84230d15248aa75057a9a53335a33860 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 | |
add_filter('leaky_paywall_filter_is_restricted', 'zeen101_bypass_in_custom_tax', 10, 3); | |
function zeen101_bypass_in_custom_tax($is_restricted, $restriction_settings, $post_id) | |
{ | |
$exclude_term_id = 54; // term id that should never be restricted | |
$terms = get_the_terms( $post_id, 'topic' ); // adjust the name of the custom taxonomy here | |
foreach( $terms as $term ) { | |
if ( $term->term_id == $exclude_term_id ) { | |
$is_restricted = false; | |
} | |
} | |
return $is_restricted; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment