Index: wp-includes/taxonomy.php
===================================================================
--- wp-includes/taxonomy.php	(revision 18922)
+++ wp-includes/taxonomy.php	(working copy)
@@ -1968,23 +1968,36 @@
  * @param string $term The term to add or update.
  * @param string $taxonomy The taxonomy to which to add the term
  * @param array|string $args Change the values of the inserted term
+ * @param bool $wp_error Allow to return WP_Error or not
  * @return array|WP_Error The Term ID and Term Taxonomy ID
  */
-function wp_insert_term( $term, $taxonomy, $args = array() ) {
+function wp_insert_term( $term, $taxonomy, $args = array(), $wp_error = true ) {
 	global $wpdb;
 
 	if ( ! taxonomy_exists($taxonomy) )
-		return new WP_Error('invalid_taxonomy', __('Invalid taxonomy'));
+		if($wp_error) {
+			return new WP_Error('invalid_taxonomy', __('Invalid taxonomy'));
+		} else {
+			return array('term_id' => 0, 'term_taxonomy_id' => 0);
+		}
 
 	$term = apply_filters( 'pre_insert_term', $term, $taxonomy );
 		if ( is_wp_error( $term ) )
 			return $term;
 
 	if ( is_int($term) && 0 == $term )
-		return new WP_Error('invalid_term_id', __('Invalid term ID'));
+		if($wp_error) {
+			return new WP_Error('invalid_term_id', __('Invalid term ID'));
+		} else {
+			return array('term_id' => 0, 'term_taxonomy_id' => 0);
+		}
 
 	if ( '' == trim($term) )
-		return new WP_Error('empty_term_name', __('A name is required for this term'));
+		if($wp_error) {
+			return new WP_Error('empty_term_name', __('A name is required for this term'));
+		} else {
+			return array('term_id' => 0, 'term_taxonomy_id' => 0);
+		}
 
 	$defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
 	$args = wp_parse_args($args, $defaults);
@@ -2026,24 +2039,40 @@
 			} else {
 				$slug = wp_unique_term_slug($slug, (object) $args);
 				if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) )
-					return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
+					if($wp_error) {
+						return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
+					} else {
+						return array('term_id' => 0, 'term_taxonomy_id' => 0);
+					}
 				$term_id = (int) $wpdb->insert_id;
 			}
 		} elseif ( $existing_term['name'] != $name ) {
 			// We've got an existing term, with a different name, Create the new term.
 			$slug = wp_unique_term_slug($slug, (object) $args);
 			if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) )
-				return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
+				if($wp_error) {
+					return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
+				} else {
+					return array('term_id' => 0, 'term_taxonomy_id' => 0);
+				}
 			$term_id = (int) $wpdb->insert_id;
 		} elseif ( $exists = term_exists( (int) $term_id, $taxonomy ) )  {
 			// Same name, same slug.
-			return new WP_Error('term_exists', __('A term with the name provided already exists.'), $exists['term_id']);
+			if($wp_error) {
+				return new WP_Error('term_exists', __('A term with the name provided already exists.'), $exists['term_id']);
+			} else {
+				return array('term_id' => 0, 'term_taxonomy_id' => 0);
+			}
 		}
 	} else {
 		// This term does not exist at all in the database, Create it.
 		$slug = wp_unique_term_slug($slug, (object) $args);
 		if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) )
-			return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
+			if($wp_error) {
+				return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error);
+			} else {
+				return array('term_id' => 0, 'term_taxonomy_id' => 0);
+			}
 		$term_id = (int) $wpdb->insert_id;
 	}
 
@@ -2270,13 +2299,18 @@
  * @param int $term_id The ID of the term
  * @param string $taxonomy The context in which to relate the term to the object.
  * @param array|string $args Overwrite term field values
+ * @param bool $wp_error Allow to return WP_Error or not
  * @return array|WP_Error Returns Term ID and Taxonomy Term ID
  */
-function wp_update_term( $term_id, $taxonomy, $args = array() ) {
+function wp_update_term( $term_id, $taxonomy, $args = array(), $wp_error = true ) {
 	global $wpdb;
 
 	if ( ! taxonomy_exists($taxonomy) )
-		return new WP_Error('invalid_taxonomy', __('Invalid taxonomy'));
+		if($wp_error) {
+			return new WP_Error('invalid_taxonomy', __('Invalid taxonomy'));
+		} else {
+			return array('term_id' => 0, 'term_taxonomy_id' => 0);
+		}
 
 	$term_id = (int) $term_id;
 
@@ -2302,7 +2336,11 @@
 	$description = stripslashes($description);
 
 	if ( '' == trim($name) )
-		return new WP_Error('empty_term_name', __('A name is required for this term'));
+		if($wp_error) {
+			return new WP_Error('empty_term_name', __('A name is required for this term'));
+		} else {
+			return array('term_id' => 0, 'term_taxonomy_id' => 0);;
+		}
 
 	$empty_slug = false;
 	if ( empty($slug) ) {
@@ -2335,7 +2373,11 @@
 		if ( $empty_slug || ( $parent != $term['parent']) )
 			$slug = wp_unique_term_slug($slug, (object) $args);
 		else
-			return new WP_Error('duplicate_term_slug', sprintf(__('The slug &#8220;%s&#8221; is already in use by another term'), $slug));
+			if($wp_error) {
+				return new WP_Error('duplicate_term_slug', sprintf(__('The slug &#8220;%s&#8221; is already in use by another term'), $slug));
+			} else {
+				return array('term_id' => 0, 'term_taxonomy_id' => 0);
+			}
 	}
 	do_action( 'edit_terms', $term_id );
 	$wpdb->update($wpdb->terms, compact( 'name', 'slug', 'term_group' ), compact( 'term_id' ) );
Index: wp-admin/includes/taxonomy.php
===================================================================
--- wp-admin/includes/taxonomy.php	(revision 18922)
+++ wp-admin/includes/taxonomy.php	(working copy)
@@ -51,7 +51,8 @@
 	if ( $id = category_exists($cat_name, $parent) )
 		return $id;
 
-	return wp_insert_category( array('cat_name' => $cat_name, 'category_parent' => $parent) );
+	$cat = wp_insert_term( $cat_name, 'category', array('name' => $name, 'parent' => $parent), false );
+	return $cat['term_id'];
 }
 
 /**
@@ -162,8 +163,10 @@
 
 	// Merge old and new fields with new fields overwriting old ones.
 	$catarr = array_merge($category, $catarr);
+	
+	$cat = wp_update_term( $catarr['cat_ID'], 'category', array('name' => $catarr['cat_name'], 'slug' => $catarr['category_nicename'], 'parent' => $catarr['category_parent'], 'description' => $catarr['category_description']), false);
 
-	return wp_insert_category($catarr);
+	return $cat['term_id'];
 }
 
 //
