How you can display only primary groups inside a dropdown list in wordpress.I must hide subcategories and want to exhibit all primary groups whether it doesn't have posts.Following script I attempted, however it exhibiting all groups(primary and subcategories).
<?php // display categories in drop down list $args = array('hide_empty'=>0,'depth'=>1); wp_dropdown_categories($args); ?>
Per the documentation for
wp_dropdown_categories, the depth argument is overlooked unless of course 'hierarchical' is placed to true. Add this argument and you ought to obtain the results you're searching for.
$args = array('hide_empty'=>0,'depth'=>1,'hierarchical'=> 1, ); wp_dropdown_categories($args);
Best Of Luck.