From 26722b77624fc755e3fcb721d2ce530abc777bd6 Mon Sep 17 00:00:00 2001 From: Joe Dolson Date: Fri, 4 Feb 2022 01:20:30 +0000 Subject: [PATCH] Comments: Only render term update notices on term screens. Prevent blank notices from appearing when adding custom fields or terms in the post editor. Props gadhiyaravi, Boniu91, ravipatel, sabernhardt. Fixes #54955. See #42937. git-svn-id: https://develop.svn.wordpress.org/trunk@52672 602fd350-edb4-49c9-b593-d223f7449a82 --- src/js/_enqueues/lib/ajax-response.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/js/_enqueues/lib/ajax-response.js b/src/js/_enqueues/lib/ajax-response.js index 659b91e023..b764823742 100644 --- a/src/js/_enqueues/lib/ajax-response.js +++ b/src/js/_enqueues/lib/ajax-response.js @@ -27,7 +27,9 @@ window.wpAjax = jQuery.extend( { var th = jQuery(this), child = jQuery(this.firstChild), response; response = { action: th.attr('action'), what: child.get(0).nodeName, id: child.attr('id'), oldId: child.attr('old_id'), position: child.attr('position') }; response.data = jQuery( 'response_data', child ).text(); - successmsg += response.data; + if ( jQuery( 'body' ).hasClass( 'edit-tags-php' ) ) { + successmsg += response.data; + } response.supplemental = {}; if ( !jQuery( 'supplemental', child ).children().each( function() { response.supplemental[this.nodeName] = jQuery(this).text(); @@ -50,7 +52,7 @@ window.wpAjax = jQuery.extend( { if ( err.length ) { re.html( '
' + err + '
' ); wp.a11y.speak( err ); - } else { + } else if ( successmsg.length ) { re.html( '

' + successmsg + '

'); jQuery(document).trigger( 'wp-updates-notice-added' ); wp.a11y.speak( successmsg );