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

How can I do this for custom post type taxonomies?

//get all child categories for category 15, then for each child category display the posts
$parent_cat = 15;
$taxonomy = 'category';
$cat_children = get_term_children( $parent_cat, $taxonomy );

if ($cat_children) {
echo '<p>Category 15</p>';
foreach($cat_children as $category) {
  'cat' => $category,
  'post_type' => 'post',
  'post_status' => 'publish',
  'posts_per_page' => -1,
  'caller_get_posts'=> 1
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
  echo 'List of Posts belonging to Category ' . $category;
  while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php     the_title_attribute(); ?>"><?php the_title(); ?></a></p>
wp_reset_query();  // Restore global post data stomped by the_post().
share|improve this question
change post_type => 'post' to your custom post type name – Bainternet May 25 '11 at 21:59
@Bainternet: Can you move that comment to an answer so we can upvote it and move this question from the "Unanswered" list? – Jan Fabry May 27 '11 at 14:22

You're doing everything fine you just need change 'post_type' => 'post' from post to your custom type.

share|improve this answer

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.