I have this code:

        'post_type' => array ('portfolio'),
        'orderby' => $orderby,
        'order' => 'DESC',
        'paged' => $paged,
        'posts_per_page' => $post_per_page,
        'ignore_sticky_posts' => $do_not_show_stickies
            $args['tax_query'] = array(
                    'taxonomy' => 'portfolio_category',
                    'field' => 'slug',
                    'terms' => $pf_categorynotin,
                    'operator' => 'NOT IN'
            ); //category__in

What I'm asking is how to add also "portfolio_tag" taxonomy because I want to list tags from my custom post type. Any suggestions on how to achieve this ? Thanks!

Later edit: here is snippet of the code that is used to retrieve portfolio categories and how they are displayed: snippet

1 Answer 1


I use this function to display comma separated terms from a custom taxonomy:

// Get Comma Seperated List of Custom Taxonomy //
function the_custom_taxonomies($taxonomy) {
    global $post;
    $terms = get_the_terms($post->ID, $taxonomy);
    $counter = 0;
    if (!empty($terms)) {
        foreach ($terms as $term) {
            echo $term->name;
            if (++$counter < count($terms))
                echo ", ";
  • But where is the taxonomy variable defined? And I don't think it will work in my case because the theme I use loads content through AJAX
    – agis
    Sep 6, 2012 at 16:36
  • You should be able to just get away with implode( ',', $terms ) instead of looping. Sep 6, 2012 at 16:36
  • Just call it like this: the_custom_taxonomies( 'my_taxonomy' ). Sep 6, 2012 at 16:38
  • I've just updated my post with a snippet of the code, please take a look.
    – agis
    Sep 6, 2012 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.