Display all taxonomy based on post type

Viewed 1192

I just want to display a taxonomy term based on post type so that I can display and filter the items based on their taxonomy.

My code below displays EVERY taxonomy. I want it to be only a specific post type Publication

<?php
     $taxonomy = 'articletype';

     $tax_terms = get_terms( $taxonomy, array(
        'post_type' => 'publication'
     ) );

 ?>
 <?php
     foreach ($tax_terms as $tax_term) {
         ?>
     <button class="button" data-filter=".<?php echo $tax_term->slug;?>" >
         <?php echo $tax_term->name;?>
     </button>
 <?php } ?>
2 Answers
Related