title: wp_dropdown_categories custom taxonomy view all
body: <p>I've got a custom post type called 'projects'.</p>
  
  <p>Attached to this is a custom taxonomy called 'type'.</p>
  
  <p>On both the 'projects' and 'type' archive pages, I have a dropdown to filter the loop results by taxonomy term (type).</p>
  
  <p>These work fine, except the 'view all' option at the top, which when clicked does not submit the form, so does nothing.</p>
  
  <p>Any ideas?</p>
  
  <p>Code in archive-projects.php &amp; taxonomy-type.php…</p>
  
  <pre><code>                    &lt;?php $args = array(
                          'show_option_all'    =&gt; 'All',
                          'hide_empty'         =&gt; 0,
                          'class'              =&gt; 'selectpicker',
                          'taxonomy'           =&gt; 'type',
                          'hide_if_empty'      =&gt; false,
                          'value_field'        =&gt; 'slug',
                      ); ?&gt;
  
                      &lt;?php wp_dropdown_categories( $args ); ?&gt;
                      &lt;script type="text/javascript"&gt;
                          var dropdown = document.getElementById("cat");
                          function onCatChange() {
                              if ( dropdown.options[dropdown.selectedIndex].value != -1 ) {
                                  location.href = "&lt;?php echo esc_url( home_url( '/projects/' ) ); ?&gt;/"+dropdown.options[dropdown.selectedIndex].value;
                              }
                          }
                          dropdown.onchange = onCatChange;
                      &lt;/script&gt;
  </code></pre>
  
  <p>functions.php…</p>
  
  <pre><code>  $projectLabels = array(
        'name' =&gt; _x('Projects', 'post type general name'),
        'singular_name' =&gt; _x('All Projects', 'post type singular name'),
        'all_items' =&gt; 'All Projects',
        'add_new' =&gt; _x('Add New', 'Project'),
        'add_new_item' =&gt; __("Add New Project"),
        'edit_item' =&gt; __("Edit Project"),
        'new_item' =&gt; __("New Project"),
        'view_item' =&gt; __("View Project"),
        'search_items' =&gt; __("Search Projects"),
        'not_found' =&gt;  __('No Project(s) found'),
        'not_found_in_trash' =&gt; __('No Project(s) found in Trash'),
        'parent_item_colon' =&gt; ''
      );
      $projectArgs = array(
        'labels' =&gt; $projectLabels,
        'public' =&gt; true,
        'publicly_queryable' =&gt; true,
        'show_ui' =&gt; true,
        'query_var' =&gt; true,
        'rewrite' =&gt; array( 'slug' =&gt; 'projects', 'with_front' =&gt; false ),
        'capability_type' =&gt; 'post',
        'hierarchical' =&gt; true,
        'menu_position' =&gt; null,
        'supports' =&gt; array('title','editor','revisions','thumbnail','custom-fields'),
        'menu_icon' =&gt; 'dashicons-building',
        'has_archive' =&gt; true
      );
      register_post_type('projects',$projectArgs);
  
  
  
      // taxonomy
      add_action( 'init', 'create_project_tax' );
  
      function create_project_tax() {
          register_taxonomy(
              'type',
              'projects',
              array(
                  'label' =&gt; __( 'Types' ),
                  'rewrite' =&gt; array( 'slug' =&gt; 'projects' ),
                  'hierarchical' =&gt; true,
              )
          );
      }
  </code></pre>