I've created dropdown menu with all current terms:
$taxonomy_names = get_post_taxonomies( );
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
$term_name = $term->name;
$args = array(
'show_option_all' => __( 'Wybierz kategorię', 'behold-basic' ),
'show_count' => 1,
'orderby' => 'name',
'selected' => 0,
'depth' => 3,
'hierarchical' => 1,
'echo' => 0,
'selected' => false,
'orderby' => 'name',
'name' => $term_name,
'class' => 'postform',
'taxonomy' => $taxonomy_names,
'value_field' => 'slug',
);
$select = wp_dropdown_categories( $args );
$replace = "<select$1 onchange='return this.form.submit()'>";
$select = preg_replace( '#<select([^>]*)>#', $replace, $select );
echo $select;
In menu I see every term names, but when I choose one I get 404. For eg. if current term is "europe" URL is "travels/europe" and when I choose "africa", url is changed to "/?Europa=africa" instead of "travels/africa".
I'm using it in taxonomy.php file, one for all my CPT.