diff --git a/src/js/_enqueues/admin/tags.js b/src/js/_enqueues/admin/tags.js
index 4ff7aaa440..474088646e 100644
|
a
|
b
|
jQuery( function($) { |
| 101 | 101 | $('#submit').on( 'click', function(){ |
| 102 | 102 | var form = $(this).parents('form'); |
| 103 | 103 | |
| 104 | | if ( ! validateForm( form ) ) |
| 105 | | return false; |
| 106 | | |
| 107 | 104 | if ( addingTerm ) { |
| 108 | 105 | // If we're adding a term, noop the button to avoid duplicate requests. |
| 109 | 106 | return false; |
| … |
… |
jQuery( function($) { |
| 127 | 124 | |
| 128 | 125 | $('#ajax-response').empty(); |
| 129 | 126 | res = wpAjax.parseAjaxResponse( r, 'ajax-response' ); |
| 130 | | if ( ! res || res.errors ) |
| | 127 | |
| | 128 | if ( res.errors && res.responses[0].errors[0].code === 'empty_term_name' ) { |
| | 129 | validateForm( form ); |
| | 130 | } |
| | 131 | |
| | 132 | if ( ! res || res.errors ) { |
| 131 | 133 | return; |
| | 134 | } |
| 132 | 135 | |
| 133 | 136 | parent = form.find( 'select#parent' ).val(); |
| 134 | 137 | |
diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php
index 964aba357f..a6ba2b678c 100644
|
a
|
b
|
function wp_ajax_add_tag() { |
| 1071 | 1071 | } |
| 1072 | 1072 | |
| 1073 | 1073 | if ( ! $tag || is_wp_error( $tag ) ) { |
| 1074 | | $message = __( 'An error has occurred. Please reload the page and try again.' ); |
| | 1074 | $message = __( 'An error has occurred. Please reload the page and try again.' ); |
| | 1075 | $error_code = 'error'; |
| 1075 | 1076 | |
| 1076 | 1077 | if ( is_wp_error( $tag ) && $tag->get_error_message() ) { |
| 1077 | 1078 | $message = $tag->get_error_message(); |
| 1078 | 1079 | } |
| 1079 | 1080 | |
| | 1081 | if ( is_wp_error( $tag ) && $tag->get_error_code() ) { |
| | 1082 | $error_code = $tag->get_error_code(); |
| | 1083 | } |
| | 1084 | |
| 1080 | 1085 | $x->add( |
| 1081 | 1086 | array( |
| 1082 | 1087 | 'what' => 'taxonomy', |
| 1083 | | 'data' => new WP_Error( 'error', $message ), |
| | 1088 | 'data' => new WP_Error( $error_code, $message ), |
| 1084 | 1089 | ) |
| 1085 | 1090 | ); |
| 1086 | 1091 | $x->send(); |