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

Hey there & merry Christmas Experts :-),

if want to have the following Scenario: Custom Post Type "Portfolio" with Tags (Filters) and Categories (Portfolio Groups)

Let's say a 1. Webdesign Category with Tags (for Filters) PHP, HTML, CSS 2. Photography Category with Tags (for Filters) Animals, Landscape

Now I can choose in the Backend from a Metabox from which Category/Categories I want to show the Portfolio. (That's what I have so far)

I Struggle with the Frontend: In the Frontend I now have to Pull the Tag-List from the chosen Portfolio Categories.

Then Pull the entries (title, permalink, ...) from the chosen Categories and display the appropriate tags.

Custom Post Type is called: portfolio Portfolio Tags called: portfolio_tag Portfolio Categories called: portfolio_category

That's what I have so far: Tags don't get pulled by selected categories, instead from all categories :/....

<div id="filters">
       <?php $tags = get_categories('taxonomy=portfolio_tag&title_li=');
       foreach ($tags as $tag){ ?>
           <li><a href="#" data-filter=".term-<?php echo $tag->name;?>" title="<?php echo $tag->count;?> <?php _e('Items', 'minti'); ?> "><?php echo $tag->name;?></a></li>
       <?php } ?>

// Array of selected categories: 
// wp_get_object_terms( get_the_ID(), 'portfolio_category'

I'm searching for the easiest, cleanest way to do this and I'm a PHP noobie :-)

Hope you can help me out. Thanks

share|improve this question
Please clarify if you are talking about real tags and categories or custom taxonomies. – toscho Dec 25 '12 at 2:37
About Custom Post Type Tags and Custom Post Type Categories, if that helps more.. – Jason Dec 25 '12 at 11:11
So you want to reuse the built-in tags and categories? You don’t use register_taxonomy()? – toscho Dec 25 '12 at 11:19
Well I want to query the tags from specific categories, let's say with the slugs webdesign, photography – Jason Dec 26 '12 at 0:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.