1

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"?

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.

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.