Index: wp-includes/taxonomy.php
===================================================================
--- wp-includes/taxonomy.php	(revision 12328)
+++ wp-includes/taxonomy.php	(working copy)
@@ -192,6 +192,9 @@
 	$args['name'] = $taxonomy;
 	$args['object_type'] = $object_type;
 	$wp_taxonomies[$taxonomy] = (object) $args;
+
+	//register meta_box
+	add_filter('wp_ajax_add-'.$taxonomy, '_wp_ajax_add_hierarchical_term');
 }
 
 //
@@ -1530,7 +1533,7 @@
  * slug has to be globally unique for every taxonomy.
  *
  * The way this works is that if the taxonomy that the term belongs to is
- * heirarchical and has a parent, it will append that parent to the $slug.
+ * hierarchical and has a parent, it will append that parent to the $slug.
  *
  * If that still doesn't return an unique slug, then it try to append a number
  * until it finds a number that is truely unique.
Index: wp-includes/post.php
===================================================================
--- wp-includes/post.php	(revision 12328)
+++ wp-includes/post.php	(working copy)
@@ -2062,6 +2062,14 @@
 		$tags = array();
 
 	$tags = is_array($tags) ? $tags : explode( ',', trim($tags, " \n\t\r\0\x0B,") );
+
+	$taxonomy_obj = get_taxonomy($taxonomy);
+	if($taxonomy_obj->hierarchical)
+	{
+		$tags = array_map('intval', $tags);
+		$tags = array_unique($tags);
+	}
+
 	wp_set_object_terms($post_id, $tags, $taxonomy, $append);
 }
 
Index: wp-includes/category-template.php
===================================================================
--- wp-includes/category-template.php	(revision 12328)
+++ wp-includes/category-template.php	(working copy)
@@ -331,6 +331,7 @@
  */
 function wp_dropdown_categories( $args = '' ) {
 	$defaults = array(
+		'taxonomy' => 'category',
 		'show_option_all' => '', 'show_option_none' => '',
 		'orderby' => 'id', 'order' => 'ASC',
 		'show_last_update' => 0, 'show_count' => 0,
@@ -356,7 +357,7 @@
 	if ( (int) $tab_index > 0 )
 		$tab_index_attribute = " tabindex=\"$tab_index\"";
 
-	$categories = get_categories( $r );
+	$categories = get_terms( $taxonomy, $r );
 	$name = esc_attr($name);
 	$class = esc_attr($class);
 

Index: wp-admin/admin-ajax.php
===================================================================
--- wp-admin/admin-ajax.php	(revision 12328)
+++ wp-admin/admin-ajax.php	(working copy)
@@ -197,6 +197,78 @@
 	$x->send();
 }
 
+/**
+ * Handles hierarchical taxonomy meta_box add functions.  Called via admin_ajax
+ * posts with action: add-{taxonomy name}
+ *
+ * @since 2.9
+ *
+ */
+function _wp_ajax_add_hierarchical_term()
+{
+	$action = $_POST['action'];
+	$taxonomy = get_taxonomy(substr($action, 4));
+	if(!$taxonomy)
+		die('-1');
+	check_ajax_referer( $action );
+	if ( !current_user_can( 'manage_categories' ) )
+		die('-1');
+	$names = explode(',', $_POST['new'.$taxonomy->name]);
+	if ( 0 > $parent = (int) $_POST['new'.$taxonomy->name.'_parent'] )
+		$parent = 0;
+	$post_category = isset($_POST['post_category'])? (array) $_POST['post_category'] : array();
+	$checked_categories = array_map( 'absint', (array) $post_category );
+	$popular_ids = isset( $_POST['popular_ids'] ) ?
+			array_map( 'absint', explode( ',', $_POST['popular_ids'] ) ) :
+			false;
+
+	$x = new WP_Ajax_Response();
+	foreach ( $names as $cat_name ) {
+		$cat_name = trim($cat_name);
+		$category_nicename = sanitize_title($cat_name);
+		if ( '' === $category_nicename )
+			continue;
+
+		if(!($cat_id = is_term($cat_name, $taxonomy->name, $parent))) {
+			$cat_id = wp_insert_term($cat_name, $taxonomy->name, array('parent'=>$parent));
+		}
+		if ( is_array($cat_id) )
+				$cat_id = $cat_id['term_id'];
+		$checked_categories[] = $cat_id;
+		if ( $parent ) // Do these all at once in a second
+			continue;
+		$category = get_term( $cat_id, $taxonomy->name);
+		ob_start();
+			wp_terms_checklist( 0, array('taxonomy'=>$taxonomy->name, 'descendants_and_self'=>$cat_id, 'selected_cats'=>$checked_categories, 'popular_cats'=>$popular_ids));
+		$data = ob_get_contents();
+		ob_end_clean();
+		$x->add( array(
+			'what' =>	$taxonomy->name,
+			'id' => $cat_id,
+			'data' => $data,
+			'position' => -1
+		) );
+	}
+	if ( $parent ) { // Foncy - replace the parent and all its children
+		$parent = get_term($parent, $taxonomy->name);
+		ob_start();
+			global $post_ID;
+			wp_terms_checklist($post_ID, array('taxonomy' => $taxonomy->name));
+		$data = ob_get_contents();
+		ob_end_clean();
+		$x->add( array(
+			'what' => $taxonomy->name,
+			'id' => $parent->term_id,
+			'old_id' => $parent->term_id,
+			'data' => $data,
+			'position' => -1
+		) );
+
+	}
+	$x->send();
+	die();
+}
+
 $id = isset($_POST['id'])? (int) $_POST['id'] : 0;
 switch ( $action = $_POST['action'] ) :
 case 'delete-comment' : // On success, die with time() instead of 1
Index: wp-admin/includes/template.php
===================================================================
--- wp-admin/includes/template.php	(revision 12328)
+++ wp-admin/includes/template.php	(working copy)
@@ -467,9 +467,15 @@
 
 	function start_el(&$output, $category, $depth, $args) {
 		extract($args);
+		if(empty($taxonomy))
+			$taxonomy = 'category';
 
+		if($taxonomy == 'category')
+			$name = 'post_category';
+		else
+			$name = 'tax_input['.$taxonomy.']';
 		$class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : '';
-		$output .= "\n<li id='category-$category->term_id'$class>" . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="post_category[]" id="in-category-' . $category->term_id . '"' . (in_array( $category->term_id, $selected_cats ) ? ' checked="checked"' : "" ) . '/> ' . esc_html( apply_filters('the_category', $category->name )) . '</label>';
+		$output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" . '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' . (in_array( $category->term_id, $selected_cats ) ? ' checked="checked"' : "" ) . '/> ' . esc_html( apply_filters('the_category', $category->name )) . '</label>';
 	}
 
 	function end_el(&$output, $category, $depth, $args) {
Index: wp-admin/wp-admin.dev.css
===================================================================
--- wp-admin/wp-admin.dev.css	(revision 12328)
+++ wp-admin/wp-admin.dev.css	(working copy)
@@ -1925,36 +1925,36 @@
 
 /* Categories */
 
-#category-adder {
+.category-adder {
 	margin-left: 120px;
 	padding: 4px 0;
 }
 
-#category-adder h4 {
+.category-adder h4 {
 	margin: 0 0 8px;
 }
 
-#side-sortables #category-adder {
+#side-sortables .category-adder {
 	margin: 0;
 }
 
-#post-body #category-add input, #category-add select {
+#post-body .category-add input, .category-add select {
 	width: 30%;
 }
 
-#side-sortables #category-add input {
+#side-sortables .category-add input {
 	width: 94%;
 }
 
-#side-sortables #category-add select {
+#side-sortables .category-add select {
 	width: 100%;
 }
 
-#category-add input#category-add-sumbit {
+#side-sortables .category-add input.category-add-sumbit, #post-body .category-add input.category-add-sumbit {
 	width: auto;
 }
 
-#post-body ul#category-tabs {
+#post-body ul.category-tabs {
 	float: left;
 	width: 120px;
 	text-align: right;
@@ -1963,11 +1963,11 @@
 	padding: 0;
 }
 
-#post-body ul#category-tabs li {
+#post-body ul.category-tabs li {
 	padding: 8px;
 }
 
-#post-body ul#category-tabs li.tabs {
+#post-body ul.category-tabs li.tabs {
 	-moz-border-radius: 3px 0 0 3px;
 	-webkit-border-top-left-radius: 3px;
 	-webkit-border-bottom-left-radius: 3px;
@@ -1977,12 +1977,12 @@
 	border-bottom-left-radius: 3px;
 }
 
-#post-body ul#category-tabs li.tabs a {
+#post-body ul.category-tabs li.tabs a {
 	font-weight: bold;
 	text-decoration: none;
 }
 
-#categorydiv div.tabs-panel,
+.categorydiv div.tabs-panel,
 #linkcategorydiv div.tabs-panel {
 	height: 200px;
 	overflow: auto;
@@ -1991,32 +1991,32 @@
 	border-width: 1px;
 }
 
-#post-body #categorydiv div.tabs-panel,
+#post-body .categorydiv div.tabs-panel,
 #post-body #linkcategorydiv div.tabs-panel {
 	margin: 0 5px 0 125px;
 }
 
-#side-sortables #category-tabs li {
+#side-sortables .category-tabs li {
 	display: inline;
 	padding-right: 8px;
 }
 
-#side-sortables #category-tabs a {
+#side-sortables .category-tabs a {
 	text-decoration: none;
 }
 
-#side-sortables #category-tabs {
+#side-sortables .category-tabs {
 	margin-bottom: 3px;
 }
 
-#categorydiv ul,
+.categorydiv ul,
 #linkcategorydiv ul {
 	list-style: none;
 	padding: 0;
 	margin: 0;
 }
 
-#categorydiv ul.categorychecklist ul,
+.categorydiv ul.categorychecklist ul,
 #linkcategorydiv ul.categorychecklist ul {
 	margin-left: 18px;
 }
@@ -2027,32 +2027,32 @@
 	line-height: 19px;
 }
 
-#category-adder h4 {
+.category-adder h4 {
 	margin-top: 4px;
 	margin-bottom: 0px;
 }
 
-#categorydiv .tabs-panel {
+.categorydiv .tabs-panel {
 	border-width: 3px;
 	border-style: solid;
 }
 
-ul#category-tabs {
+ul.category-tabs {
 	margin-top: 12px;
 }
 
-ul#category-tabs li.tabs {
+ul.category-tabs li.tabs {
 	border-style: solid solid none;
 	border-width: 1px 1px 0;
 }
 
-#post-body #category-tabs li.tabs {
+#post-body .category-tabs li.tabs {
 	border-style: solid none solid solid;
 	border-width: 1px 0 1px 1px;
 	margin-right: -1px;
 }
 
-ul#category-tabs li {
+ul.category-tabs li {
 	padding: 5px 8px;
 	-moz-border-radius: 3px 3px 0 0;
 	-webkit-border-top-left-radius: 3px;
Index: wp-admin/css/colors-classic.dev.css
===================================================================
--- wp-admin/css/colors-classic.dev.css	(revision 12328)
+++ wp-admin/css/colors-classic.dev.css	(working copy)
@@ -105,11 +105,11 @@
 }
 
 div.tabs-panel,
-ul#category-tabs li.tabs {
+ul.category-tabs li.tabs {
 	border-color: #dfdfdf;
 }
 
-ul#category-tabs li.tabs {
+ul.category-tabs li.tabs {
 	background-color: #f1f1f1;
 }
 
@@ -384,7 +384,7 @@
 	background:#faf9f7 !important;
 }
 
-#side-sortables #category-tabs .tabs a {
+#side-sortables .category-tabs .tabs a {
 	color: #333;
 }
 
@@ -1459,7 +1459,7 @@
 	background-color: #f5f5f5;
 }
 
-#post-body ul#category-tabs li.tabs a {
+#post-body ul.category-tabs li.tabs a {
 	color: #333;
 }
 
Index: wp-admin/css/press-this.dev.css
===================================================================
--- wp-admin/css/press-this.dev.css	(revision 12328)
+++ wp-admin/css/press-this.dev.css	(working copy)
@@ -308,11 +308,11 @@
 	display: none;
 }
 
-#category-adder {
+.category-adder {
 	padding: 4px 0;
 }
 
-#category-adder h4 {
+.category-adder h4 {
 	margin: 0 0 8px;
 }
 
@@ -339,23 +339,23 @@
 }
 
 #category-add input,
-#category-add-sumbit {
+.category-add-sumbit {
 	width: auto;
 }
 
 /* Categories */
-#categorydiv ul,
+.categorydiv ul,
 #linkcategorydiv ul {
 	list-style: none;
 	padding: 0;
 	margin: 0;
 }
 
-#categorydiv ul.categorychecklist ul {
+.categorydiv ul.categorychecklist ul {
 	margin-left: 18px;
 }
 
-#categorydiv div.tabs-panel {
+.categorydiv div.tabs-panel {
 	height: 140px;
 	overflow: auto;
 }
Index: wp-admin/css/colors-fresh.dev.css
===================================================================
--- wp-admin/css/colors-fresh.dev.css	(revision 12328)
+++ wp-admin/css/colors-fresh.dev.css	(working copy)
@@ -105,11 +105,11 @@
 }
 
 div.tabs-panel,
-ul#category-tabs li.tabs {
+ul.category-tabs li.tabs {
 	border-color: #dfdfdf;
 }
 
-ul#category-tabs li.tabs {
+ul.category-tabs li.tabs {
 	background-color: #f1f1f1;
 }
 
@@ -380,7 +380,7 @@
 	border-color: #dfdfdf;
 }
 
-#side-sortables #category-tabs .tabs a {
+#side-sortables .category-tabs .tabs a {
 	color: #333;
 }
 
@@ -1454,7 +1454,7 @@
 	background-color: #f5f5f5;
 }
 
-#post-body ul#category-tabs li.tabs a {
+#post-body ul.category-tabs li.tabs a {
 	color: #333;
 }
 
Index: wp-admin/rtl.dev.css
===================================================================
--- wp-admin/rtl.dev.css	(revision 12328)
+++ wp-admin/rtl.dev.css	(working copy)
@@ -298,7 +298,7 @@
 	margin-left: 0;
 	margin-right: 120px;
 }
-#post-body ul#category-tabs li.tabs {
+#post-body ul.category-tabs li.tabs {
 	-moz-border-radius: 0 3px 3px 0;
 	-webkit-border-top-left-radius: 0;
 	-webkit-border-top-right-radius: 3px;
@@ -309,7 +309,7 @@
 	border-bottom-left-radius: 0;
 	border-bottom-right-radius: 3px;
 }
-#post-body ul#category-tabs {
+#post-body ul.category-tabs {
 	float: right;
 	text-align: left;
 	margin: 0 0 0 -120px;
@@ -320,7 +320,7 @@
 }
 /* 1800 - 2000
 =================================== */
-#side-sortables #category-tabs li {
+#side-sortables .category-tabs li {
 	padding-right: 0;
 	padding-left: 8px;
 }
