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've built a hierarchical taxonomy that displays a master list of available fragrances in the admin. When you create a page, you checkmark the fragrances that are available for that particular post. I used this code to functions.php and it seems to work in the admin:

add_action( 'init', 'build_taxonomies', 0 );

function build_taxonomies() {
array( 'hierarchical' => true,
'label' => 'Scents',
'query_var' => true,
'rewrite' => true ) );

Now I need to output the checkmarked items so they display on the post in the form of a drop down menu.

The problem is that it outputs ALL scents that have been check marked across ALL pages. I just need it to output the ones that have been check marked on the page you're on.

Here's the code I used:

<?php wp_dropdown_categories('taxonomy=scents'); ?>

How to edit this so that it only shows the fragrances for the page I'm on? Thanks.

share|improve this question

If I understand correctly, you want to display the taxonomies you selected in the admin UI when you display your custom post type in the frontend. What you will need to do in that case is to modify the template file that displays your post, and use something like (adapted from content-single.php under TwentyEleven:

<?php $scent_list = get_the_term_list( $post->ID, 'scents', '', ', ', '' ); 
      if ($scent_list): ?>
          <span class="scent-links">
              <?php printf( __( '<span class="%1$s">Scents</span> %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-tag-links', $scent_list);
                    $show_sep = true; ?>

<?php endif; // $artist_list ?>

This will display a list of the scents that are selected, but you could modify that output to show it as a dropdown list.

share|improve this answer
Thanks englebip! I dropped the code in and it worked perfectly! I've been trying to modify it to display as a select menu without any luck. Any chance you could show me an example of the above code as a menu? – Nathan Feb 16 '12 at 18:15

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.