I am presently while using list_terms_exclusions filter inside a wordpress wordpress plugin to try to filter a listing of groups by ID in the category list hooks used throughout wordpress.

During my wordpress plugin I am trying to own choice to "Exclude" (how list_terms_exclusions is usually use) the groups, hiding them in the calls, or "Include" the groups, effectively restricting the course list hooks to simply a particular group of groups.

(I recognize obviously this would seldom be utilized, however i would like it to work right).

The exclusion facet of my wordpress plugin works as planned, however when I switch the terminology around to "include", it technically works as intended, but this permanently alters any tag hooks utilized in wordpress, basically hiding all tags in the tag hooks.

I am wishing individuals will possess some experience into how you can remedy this issue. The function that I am using with list_terms_exclusions is the following:

function exclude_list_cat( $exclusions ) {
$options = get_option('aa_CategoriesCatLinks');
$aa_CATincludeExclude = get_option('aa_CATincludeExclude');
if ( is_array($options) && !is_admin() && $aa_CATincludeExclude == 'Exclude' ) {
    $excludeCats = implode( ',', $options);
    $exclusions = "AND (t.term_id NOT IN (".$excludeCats.")) ";
    echo 'EXCLUSIONS = '.$exclusions.'<br />';
} elseif ( is_array($options) && !is_admin() && $aa_CATincludeExclude == 'Include' ) {
    $includeCats = implode( ',', $options);
    $exclusions = "AND (t.term_id IN (".$includeCats.")) ";
    echo 'INCLUSIONS = '.$exclusions.'<br />';
} else {
    //echo 'No options selected';
    $exclusions = '';
}
return $exclusions;

}