Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to query for a single term in a custom post type
<?php
query_posts( array( 'post_type' => 'custom', 'taxonomy-slug' => 'term-slug' ) );
if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h3><?php the_title(); ?></h3>
<?php the_content(); ?>
<?php endwhile; endif; wp_reset_query(); ?>
<?php wp_reset_postdata(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.