You need to dive in the wp_dropdown_categories( $args );
and wp_list_categories
functions to list your terms, even if I don’t think it’s the better way. For accordion you will need to compose your own select and option entries and use your own css/js like Smooth accordion dropdown menu.
It’s possible to list term hierarchically with wp_dropdown_categories( $args );
.
the list of args to change as you want :
$args = array(
'show_option_all' => '',
'show_option_none' => '',
'option_none_value' => '-1',
'orderby' => 'ID',
'order' => 'ASC',
'show_count' => 0,
'hide_empty' => 1,
'child_of' => 0,
'exclude' => '',
'include' => '',
'echo' => 1,
'selected' => 0,
'hierarchical' => 1,
'name' => 'cat',
'id' => '',
'class' => 'postform scrollable-menu',
'depth' => 0,
'tab_index' => 0,
'taxonomy' => 'category',
'hide_if_empty' => false,
'value_field' => 'term_id',
);
wp_dropdown_categories($args);
To make the select dropdown scrollable,
.scrollable-menu {
height: auto;
max-height: 200px;
overflow-x: hidden;
}
Hope it helps you !