Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save maxyudin/69f7957fe68080587de1e09e610202b7 to your computer and use it in GitHub Desktop.
Save maxyudin/69f7957fe68080587de1e09e610202b7 to your computer and use it in GitHub Desktop.
<?php
// Edition 1
$taxonomy_name = 'sample-cpt-category';
if ( is_tax( $taxonomy_name ) ) {
$current_taxonomy_term = get_queried_object_id();
$args = array(
'taxonomy' => $taxonomy_name,
'exclude' => $current_taxonomy_term
);
$taxonomy_terms = get_terms( $args );
}
// Edition 2
$taxonomy_name = 'sample-cpt-category';
if ( is_tax( $taxonomy_name ) ) {
$current_taxonomy_term = get_queried_object_id();
$args = array(
'taxonomy' => array($taxonomy_name),
'exclude' => $current_taxonomy_term
);
$taxonomy_terms = new WP_Term_Query( $args );
$taxonomy_terms = $taxonomy_terms->terms;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment