Add this code in the file functions.php of the theme directory: <?php function exclude_widget_subcategories($args){ $all_categories = get_all_category_ids(); $exclude_categories = array(); foreach($all_categories as $category_id){ $category = get_category($category_id); if($category->parent!=0){ $exclude_categories[] = $category_id; } } $exclude = implode(",",$exclude_categories); // The IDs of the excluding categories $args["exclude"] = $exclude; return $args; } add_filter("widget_categories_args","exclude_widget_subcategories"); ?> Code (markup): This is modified code of the post http://rubensargsyan.com/exclude-categories-from-the-default-widget-categories/
use this plugin to hide subcategories Enhanced Category widget http://wordpress.org/extend/plugins/my-category-order/ Code (markup):
I use AVH Extended Categories Widgets to arrange my categories and subcategories. You can also use My Category Order for the same purpose.