WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have this simple snippet to retrieve the categories (taxonomies) of my Custom Post Type 'portfolio' I need to display each taxonomy but it displays all the categories.

I just saw this question Filter get_categories() for taxonomy term in WordPress and unfortunately I tried with no success.

    if ( have_posts() ) : while ( have_posts() ) : the_post(); 
    $catid = get_cat_id('Images');

    $categories=  get_categories('child_of='.$catid.'&orderby=name'); 
    foreach ($categories as $cat) {
    $input = '<li><a href="#" data-value="category-'.$cat->category_nicename.'">';
      $input .= $cat->cat_name;
      $input .= '</a></li>';
      echo $input;

Can you please guide me or give me a hint? Thanks so much.

share|improve this question
categories (taxonomies) Category is taxonomy but other taxonomies are not categories. Could you please explain better what exactly you want to retrieve? Terms from several taxonomies? – Rarst Jan 13 '11 at 8:30
Can you give us an idea of what type of data/use-case you are working with? Like @Rarst I don't understand what you are trying to accomplish. – MikeSchinkel Jan 13 '11 at 8:33
Sure let me explain better. I have a Custom Post Type in my custom post type I've created a Custom Taxonomy called 'Portfolio' with 1 category called 'Work' (parent) with 3 childs (Images, Video Production, Web Design). I want to display the Name of the child categories into a list. Sorry for my english – Ivor Jan 13 '11 at 8:44
up vote 0 down vote accepted

First, you are mixing up terminology a bit. Portfolio is taxonomy, but Work, Images, etc are terms (not categories).

So you need to adjust functions for your taxonomy. Try this:


$catid = get_cat_id('Images');


$catid = get_term_by( 'name', 'Images', 'portfolio' );
$catid = $catid->term_id;


$categories = get_categories('child_of='.$catid.'&orderby=name'); 


$categories = get_categories('child_of='.$catid.'&orderby=name&taxonomy=portfolio');
share|improve this answer
Thanks so much Rarst, I think I'm "on the road" – Ivor Jan 14 '11 at 3:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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