Changeset 6329
- Timestamp:
- 11/12/2007 07:12:49 PM (16 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r6303 r6329 200 200 } 201 201 202 if ( !$cat = wp_insert_category( $_POST ) ) 203 die('0'); 204 if ( !$cat = get_category( $cat ) ) 205 die('0'); 202 $cat = wp_insert_category( $_POST, true ); 203 204 if ( is_wp_error($cat) ) { 205 $x = new WP_Ajax_Response( array( 206 'what' => 'cat', 207 'id' => $cat 208 ) ); 209 $x->send(); 210 } 211 212 if ( !$cat || (!$cat = get_category( $cat )) ) 213 die('0'); 214 206 215 $level = 0; 207 216 $cat_full_name = $cat->name; -
trunk/wp-admin/includes/taxonomy.php
r6157 r6329 53 53 } 54 54 55 function wp_insert_category($catarr ) {55 function wp_insert_category($catarr, $wp_error = false) { 56 56 global $wpdb; 57 57 … … 85 85 $cat_ID = wp_insert_term($cat_name, 'category', $args); 86 86 87 if ( is_wp_error($cat_ID) ) 88 return 0; 87 if ( is_wp_error($cat_ID) ) { 88 if ( $wp_error ) 89 return $cat_ID; 90 else 91 return 0; 92 } 89 93 90 94 return $cat_ID['term_id'];
Note: See TracChangeset
for help on using the changeset viewer.