Is it possible to have a page which shows a list of the custom tax parents only and only 1 post per custom tax, i/e link to the parent archive

So even though the custom tax may have x number of posts and x number of child custom tax's its basically just showing a link to that custom tax archive page parent.

SO essentially an archive page just for the custom tax parents ignoring the posts within.

I can do this manually with a page template and query each custom tax individually but wondered if it could be done dynamically.

I have the following but its spitting out all the posts within the category. Perhaps get_terms is needed i'm not sure?


                    $args = array(
                       'posts_per_page' => -1,
                        'post_type' => 'product',
                        'tax_query' => array(
                                        'taxonomy' => 'product-area',
                                        'field' => 'slug',
                                        'terms' => array('insulation','drylining-plastering'),
                                        'include_children' => false
                    $products_tax = new WP_Query( $args );

                   if($products_tax->have_posts()) : 
                      while($products_tax->have_posts()) : 

                <h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
                    <?php the_title(); ?>


                      Oops, there are no posts.


1 Answer 1


I've managed to figure this out myself, so if anyone out there needs some help please try the following...

Using the get_terms rather than trying to query it directly.


                    $terms = get_terms('custom-tax-name', array('hierarchical' => false));
                    foreach ($terms as $term) {

                    $term_link = get_term_link( $term );

                     if ( have_posts() ) :


                     <a href="<?php echo $term_link; ?>">
                     <?php echo '<h3>'.$term->name.'</h3>'; ?>


                <?php endif; wp_reset_query(); } ?>

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.