custom wp_dropdown_categories items in wordpress

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?

Read More

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

Related posts

Leave a Reply

1 comment

  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.