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'm designing a custom magazine theme, where categories are used for different sections, and I created a custom "edition" taxonomy.

The editor will create a new term in that taxonomy for each new edition published, i.e. the number of the issue.

How can I query the latest "edition", so I can combine it with each category and then publish only the posts that belong to the newest edition?

Something along the lines on: ?edition=34&cat=studies

share|improve this question
up vote 2 down vote accepted

The latest edition should always be the term in that taxonomy with the highest term_id, right? Query get_terms and find the latest edition, then use that term to build the rest of your query...

$edition = get_terms('edition','orderby=none&order=DESC&number=1');
$latest_edition = $edition[0]->slug;

Then you can either modify the current query, if that's what you want to do:

global $wp_query;

Or use it to build new queries:

$studiesposts = get_posts('category_name=Studies&edition='.$latest_edition);

If you have your permalink structure set up, it should also work to build urls for new links, like this:

share|improve this answer
That should be the case. Can you help me build that query? thanks! – Sergio Majluf Nov 15 '10 at 16:00
Yeah, I added a few examples above. Hope that helps! – goldenapples Nov 15 '10 at 18:31

You can use the plugin Query Multiple Taxonomies.

share|improve this answer
Thanks, that´s a good starting point :) – Sergio Majluf Nov 15 '10 at 17:05

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.