Skip to content

Instantly share code, notes, and snippets.

@greenhornet79
Created September 26, 2023 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greenhornet79/84230d15248aa75057a9a53335a33860 to your computer and use it in GitHub Desktop.
Save greenhornet79/84230d15248aa75057a9a53335a33860 to your computer and use it in GitHub Desktop.
<?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