I have created a Custom Post Type - "magazine_entry" and have registered the taxonomy "division". I have then created several divisions such as, "international", "tokyo", "kansai", etc...

I am trying to display the 3 most recent posts from a single taxonomy of the custom post type.

For example, have

(i will handle the css and html later)

post 1      post 2     post 3    

post 1      post 2     post 3


I can get all posts from the custom post type to show up, but I don't know how to get the posts from just one of the taxonomies.

1 Answer 1


You should use Taxonomy Parameters available in WP_Query. For example, to get the three recents magazine_entry posts having the international term slug, you can use:

$args = array(
    'post_type' => 'magazine_entry',
    'posts_per_page' => 3
    'tax_query' => array(
            'taxonomy' => 'division',
            'field' => 'slug',
            'terms' => 'international'
$query = new WP_Query( $args );
  • Great! Of course it is that simple. I always look for the hard and gritty solutions =/ Now I will start to work on turning the posts per page into Epanel options.
    – user33426
    Commented May 29, 2013 at 7:07
  • In addition, could you tell me where to start in terms of setting a loop that will for example, display the 3 most recent posts from all of the taxonomy categories, automatically, rather than having to set up a new loop each time I make a new category?
    – user33426
    Commented May 29, 2013 at 7:08
  • Get all your terms using get_terms('division').
    – RRikesh
    Commented May 29, 2013 at 7:10

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.