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


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:

  • 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.