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 a custom taxonomy called Issues (like magazine issues) with categories named after the title of each issue. I created a page called "Current Issue" and added a link to it in the main navigation of the site.

This is the loop I have in the page template now:

$categories = get_terms('issue', 'orderby=count&order=asc');
 foreach( $categories as $category ): 
 <h3><?php echo $category->name; ?></h3>
 $posts = get_posts(array(
 'post_type' => 'issue_posts',
 'taxonomy' => $category->taxonomy,
 'term' => $category->slug,
 'nopaging' => true,
 foreach($posts as $post): 

It does order the categories and posts appropriately, but this pulls in all the posts for all the categories. I need the link to show only the posts from the most recent category.

Thanks in advance for any help

share|improve this question

Terms are assigned a unique ID when added, and the ID will always increment, so the most recently added term will be the one with the highest ID.

With this in mind, if you fetch a single term ordered by ID in descending order, you should get the most recently added term:

$args = array(
    'number' => 1,
    'orderby' => 'ID',
    'order' => 'DESC'

$recent_issue = get_terms( 'issue', $args );
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.