Index: wp-admin/admin-db.php
===================================================================
--- wp-admin/admin-db.php	(revision 5264)
+++ wp-admin/admin-db.php	(working copy)
@@ -213,7 +213,7 @@
 	// Update children to point to new parent
 	$wpdb->query("UPDATE $wpdb->categories SET category_parent = '$parent' WHERE category_parent = '$cat_ID'");
 
-	// Only set posts and links to the default category if they're not in another category already
+	// Only set posts links to the default category if they're not in another category already
 	$posts = $wpdb->get_col("SELECT post_id FROM $wpdb->post2cat WHERE category_id='$cat_ID' AND rel_type = 'category'");
 	foreach ( (array) $posts as $post_id ) {
 		$cats = wp_get_post_categories($post_id);
@@ -224,7 +224,49 @@
 		wp_set_post_categories($post_id, $cats);
 	}
 
-	$links = $wpdb->get_col("SELECT link_id FROM $wpdb->link2cat WHERE category_id='$cat_ID'");
+	clean_category_cache($cat_ID);
+	do_action('delete_category', $cat_ID);
+	return 1;
+}
+
+function wp_create_category($cat_name) {
+	$cat_array = compact('cat_name');
+	return wp_insert_category($cat_array);
+}
+
+function wp_create_link_category($cat_name) {
+	$type = TAXONOMY_LINK_CATEGORY;
+	$cat_array = compact('cat_name', 'type');
+	return wp_insert_category($cat_array);
+}
+
+function wp_delete_link_category($cat_ID) {
+	global $wpdb;
+
+	$cat_ID = (int) $cat_ID;
+	$default_link_cat = get_option('default_link_category');
+
+	// Don't delete either of the default cats
+	if ( $cat_ID == $default_link_cat )
+		return 0;
+
+	$category = get_category($cat_ID);
+	$parent = $category->category_parent;
+
+	// Delete the category if it is not also a tag or regular category.
+	if ( 0 == ($category->type & TAXONOMY_TAG) || 0 == ($category->type & TAXONOMY_CATEGORY) ) {
+		if ($wpdb->query("DELETE FROM $wpdb->categories WHERE cat_ID = '$cat_ID'")) {
+			// Update children to point to new parent
+			$wpdb->query("UPDATE $wpdb->categories SET category_parent = '$parent' WHERE category_parent = '$cat_ID'");
+		} else {
+			return false;
+		}
+	} else {
+		$wpdb->query("UPDATE $wpdb->categories SET type = type & ~" . TAXONOMY_LINK_CATEGORY . " WHERE cat_ID = '$cat_ID'");
+	}
+	
+	// Only set links to the default category if they're not in another category already
+	$links = $wpdb->get_col("SELECT link_id FROM $wpdb->link2cat WHERE category_id = '$cat_ID'");
 	foreach ( (array) $links as $link_id ) {
 		$cats = wp_get_link_cats($link_id);
 		if ( 1 == count($cats) )
@@ -236,14 +278,10 @@
 
 	clean_category_cache($cat_ID);
 	do_action('delete_category', $cat_ID);
-	return 1;
+	
+	return true;
 }
 
-function wp_create_category($cat_name) {
-	$cat_array = compact('cat_name');
-	return wp_insert_category($cat_array);
-}
-
 function wp_create_categories($categories, $post_id = '') {
 	$cat_ids = array ();
 	foreach ($categories as $category) {

