0 && $('#tag-' + parent ).length > 0 ) // If the parent exists on this page, insert it below. Else insert it at the top of the list.
- $('#the-list #tag-' + parent).after(r);
- else
- $('#the-list').prepend(r);
- $('input[type="text"]:visible, textarea:visible', form).val('');
+ $('#ajax-response').empty();
+ var res = wpAjax.parseAjaxResponse(r, 'ajax-response');
+ if ( ! res )
+ return;
+
+ var parent = form.find('select#parent').val();
+
+ if ( parent > 0 && $('#tag-' + parent ).length > 0 ) // If the parent exists on this page, insert it below. Else insert it at the top of the list.
+ $('#the-list #tag-' + parent).after( res.responses[0].supplemental['noparents'] ); // As the parent exists, Insert the version with - - - prefixed
+ else
+ $('#the-list').prepend( res.responses[0].supplemental['parents'] ); // As the parent is not visible, Insert the version with Parent - Child - ThisTerm
+
+ if ( form.find('select#parent') ) {
+ // Parents field exists, Add new term to the list.
+ var term = res.responses[1].supplemental;
+
+ // Create an indent for the Parent field
+ var indent = '';
+ for ( var i = 0; i < res.responses[1].position; i++ )
+ indent += ' ';
+
+ form.find('select#parent option:selected').after('');
}
+
+ $('input[type="text"]:visible, textarea:visible', form).val('');
});
return false;
diff --git a/wp-admin/js/tags.js b/wp-admin/js/tags.js
index 1928515652..08349dc2af 100644
--- a/wp-admin/js/tags.js
+++ b/wp-admin/js/tags.js
@@ -1 +1 @@
-jQuery(document).ready(function($){$(".delete-tag").live("click",function(e){var t=$(this),tr=t.parents("tr"),r=true,data;if("undefined"!=showNotice){r=showNotice.warn()}if(r){data=t.attr("href").replace(/[^?]*\?/,"").replace(/action=delete/,"action=delete-tag");$.post(ajaxurl,data,function(r){if("1"==r){$("#ajax-response").empty();tr.fadeOut("normal",function(){tr.remove()})}else{if("-1"==r){$("#ajax-response").empty().append('
0&&$("#tag-"+parent).length>0){$("#the-list #tag-"+parent).after(r)}else{$("#the-list").prepend(r)}$('input[type="text"]:visible, textarea:visible',form).val("")}});return false})});
\ No newline at end of file
+jQuery(document).ready(function($){$(".delete-tag").live("click",function(e){var t=$(this),tr=t.parents("tr"),r=true,data;if("undefined"!=showNotice){r=showNotice.warn()}if(r){data=t.attr("href").replace(/[^?]*\?/,"").replace(/action=delete/,"action=delete-tag");$.post(ajaxurl,data,function(r){if("1"==r){$("#ajax-response").empty();tr.fadeOut("normal",function(){tr.remove()});$("select#parent option[value="+data.match(/tag_ID=(\d+)/)[1]+"]").remove();$("a.tag-link-"+data.match(/tag_ID=(\d+)/)[1]).remove()}else{if("-1"==r){$("#ajax-response").empty().append('