Skip to content

Instantly share code, notes, and snippets.

@tokopress
Created August 9, 2016 12:50
Show Gist options
  • Save tokopress/a5a0eff226bc5669b25c6711776cd501 to your computer and use it in GitHub Desktop.
Save tokopress/a5a0eff226bc5669b25c6711776cd501 to your computer and use it in GitHub Desktop.
Eventica - Exclude Some Event Categories on Frontend
add_action( 'get_the_terms', 'tokopress_custom_exclude_event_categories_single', 10 );
function tokopress_custom_exclude_event_categories_single( $terms ) {
$exclude = array( 261, 262 );
if ( !is_admin() && !empty( $terms ) ) {
foreach ( $terms as $key => $term ) {
if ( $term->term_id && in_array( $term->term_id, $exclude ) ) {
unset( $terms[$key] );
}
}
}
return $terms;
}
add_action( 'get_terms', 'tokopress_custom_exclude_event_categories', 10 );
function tokopress_custom_exclude_event_categories( $terms ) {
$exclude = array( 261, 262 );
if ( !is_admin() && !empty( $terms ) ) {
foreach ( $terms as $key => $term ) {
if ( $term->term_id && in_array( $term->term_id, $exclude ) ) {
unset( $terms[$key] );
}
}
}
return $terms;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment