diff --git src/js/_enqueues/lib/ajax-response.js src/js/_enqueues/lib/ajax-response.js
index b764823742..603fc61a76 100644
|
|
window.wpAjax = jQuery.extend( { |
18 | 18 | return r; |
19 | 19 | }, |
20 | 20 | parseAjaxResponse: function( x, r, e ) { // 1 = good, 0 = strange (bad data?), -1 = you lack permission. |
21 | | var parsed = {}, re = jQuery('#' + r).empty(), err = '', successmsg = ''; |
| 21 | var parsed = {}, re = jQuery('#' + r).empty(), err = '', noticemsg = ''; |
22 | 22 | |
23 | 23 | if ( x && typeof x === 'object' && x.getElementsByTagName('wp_ajax') ) { |
24 | 24 | parsed.responses = []; |
… |
… |
window.wpAjax = jQuery.extend( { |
27 | 27 | var th = jQuery(this), child = jQuery(this.firstChild), response; |
28 | 28 | response = { action: th.attr('action'), what: child.get(0).nodeName, id: child.attr('id'), oldId: child.attr('old_id'), position: child.attr('position') }; |
29 | 29 | response.data = jQuery( 'response_data', child ).text(); |
30 | | if ( jQuery( 'body' ).hasClass( 'edit-tags-php' ) ) { |
31 | | successmsg += response.data; |
32 | | } |
33 | 30 | response.supplemental = {}; |
34 | 31 | if ( !jQuery( 'supplemental', child ).children().each( function() { |
| 32 | |
| 33 | if ( this.nodeName === 'notice' ) { |
| 34 | noticemsg += jQuery(this).text(); |
| 35 | return; |
| 36 | } |
| 37 | |
35 | 38 | response.supplemental[this.nodeName] = jQuery(this).text(); |
36 | 39 | } ).length ) { response.supplemental = false; } |
37 | 40 | response.errors = []; |
… |
… |
window.wpAjax = jQuery.extend( { |
52 | 55 | if ( err.length ) { |
53 | 56 | re.html( '<div class="error">' + err + '</div>' ); |
54 | 57 | wp.a11y.speak( err ); |
55 | | } else if ( successmsg.length ) { |
56 | | re.html( '<div class="updated notice is-dismissible"><p>' + successmsg + '</p></div>'); |
| 58 | } else if ( noticemsg.length ) { |
| 59 | re.html( '<div class="updated notice is-dismissible"><p>' + noticemsg + '</p></div>'); |
57 | 60 | jQuery(document).trigger( 'wp-updates-notice-added' ); |
58 | | wp.a11y.speak( successmsg ); |
| 61 | wp.a11y.speak( noticemsg ); |
59 | 62 | } |
60 | 63 | return parsed; |
61 | 64 | } |
diff --git src/wp-admin/includes/ajax-actions.php src/wp-admin/includes/ajax-actions.php
index b81710ddef..9d301e514c 100644
|
|
function wp_ajax_add_tag() { |
1115 | 1115 | array( |
1116 | 1116 | 'what' => 'taxonomy', |
1117 | 1117 | 'data' => $message, |
1118 | | 'supplemental' => compact( 'parents', 'noparents' ), |
| 1118 | 'supplemental' => array( |
| 1119 | 'parents' => $parents, |
| 1120 | 'noparents' => $noparents, |
| 1121 | 'notice' => $message, |
| 1122 | ), |
1119 | 1123 | ) |
1120 | 1124 | ); |
1121 | 1125 | |