Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have the wp_dropdown_categories function in my searchform.php file. Right now it lets the user choose what post category they want to search in.

Is there a way I can get the drop down to include a custom taxonomy and a custom post type?

For example if I have a custom post type for galleries, and a custom taxonomy for places... how can I display a wp-dropdown that lets the user choose to search either "photos" or "locations"?

share|improve this question

1 Answer 1

You should be able to send the desired taxonomies as an argument to the function. This is untested, but should work:

$args = array(
    'taxonomy' => array(
        'galleries',
        'places'
    )
);
echo wp_dropdown_categories($args);

For your reference, the function wp_dropdown_categories is defined in "wp-includes/category-template.php" on line 301. Take a look at it as it will help you understand what you can send as arguments for the function.

share|improve this answer

Your Answer

 
discard

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.