From 6f5ca5962f0fe10b23ec350c1b07c06f473e200b Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Sat, 13 Feb 2010 06:04:54 +0000 Subject: [PATCH] Flow on tax-modification errors on Tax inline edit to the UI. See #11838 git-svn-id: https://develop.svn.wordpress.org/trunk@13088 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/admin-ajax.php | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index d4632af2d2..1c03ba8de4 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -1131,25 +1131,6 @@ case 'inline-save-tax': die(-1); switch ($_POST['tax_type']) { - case 'cat' : - $data = array(); - $data['cat_ID'] = $id; - $data['cat_name'] = $_POST['name']; - $data['category_nicename'] = $_POST['slug']; - if ( isset($_POST['parent']) && (int) $_POST['parent'] > 0 ) - $data['category_parent'] = $_POST['parent']; - - $cat = get_category($id, ARRAY_A); - $data['category_description'] = $cat['category_description']; - - $updated = wp_update_category($data); - - if ( $updated && !is_wp_error($updated) ) - echo _cat_row( $updated, 0 ); - else - die( __('Category not updated.') ); - - break; case 'link-cat' : $updated = wp_update_term($id, 'link_category', $_POST); @@ -1168,12 +1149,17 @@ case 'inline-save-tax': $updated = wp_update_term($id, $taxonomy, $_POST); if ( $updated && !is_wp_error($updated) ) { $tag = get_term( $updated['term_id'], $taxonomy ); - if ( !$tag || is_wp_error( $tag ) ) - die( __('Tag not updated.') ); + if ( !$tag || is_wp_error( $tag ) ) { + if ( is_wp_error($tag) && $tag->get_error_message() ) + die( $tag->get_error_message() ); + die( __('Item not updated.') ); + } - echo _tag_row($tag, 0, '', $taxonomy); + echo _tag_row($tag, 0, $taxonomy); } else { - die( __('Tag not updated.') ); + if ( is_wp_error($updated) && $updated->get_error_message() ) + die( $updated->get_error_message() ); + die( __('Item not updated.') ); } break;