Ticket #14067: 14067.diff
File 14067.diff, 1.5 KB (added by , 15 years ago) |
---|
-
wp-includes/taxonomy.php
1647 1647 if ( false === $wpdb->insert( $wpdb->terms, compact( 'name', 'slug', 'term_group' ) ) ) 1648 1648 return new WP_Error('db_insert_error', __('Could not insert term into the database'), $wpdb->last_error); 1649 1649 $term_id = (int) $wpdb->insert_id; 1650 } elseif ( term_exists( (int) $term_id, $taxonomy ) ) {1650 } elseif ( $exists = term_exists( (int) $term_id, $taxonomy ) ) { 1651 1651 // Same name, same slug. 1652 return new WP_Error('term_exists', __('A term with the name provided already exists.') );1652 return new WP_Error('term_exists', __('A term with the name provided already exists.'), $exists); 1653 1653 } 1654 1654 } else { 1655 1655 // This term does not exist at all in the database, Create it. -
xmlrpc.php
933 933 "category_description" => $category["description"] 934 934 ); 935 935 936 $cat_id = wp_insert_category($new_category); 937 if ( !$cat_id ) 936 $cat_id = wp_insert_category($new_category, true); 937 if ( is_wp_error( $cat_id ) ) { 938 if ( 'term_exists' == $cat_id->get_error_code() ) 939 return $cat_id->get_error_data(); 940 else 941 return(new IXR_Error(500, __("Sorry, the new category failed."))); 942 } elseif ( ! $cat_id ) { 938 943 return(new IXR_Error(500, __("Sorry, the new category failed."))); 944 } 939 945 940 946 return($cat_id); 941 947 }