Last active
April 19, 2017 15:38
-
-
Save maxyudin/69f7957fe68080587de1e09e610202b7 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 | |
// 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