Make WordPress Core

Changeset 52672


Ignore:
Timestamp:
02/04/2022 01:20:30 AM (2 years ago)
Author:
joedolson
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/lib/ajax-response.js

    r52170 r52672  
    2828                response = { action: th.attr('action'), what: child.get(0).nodeName, id: child.attr('id'), oldId: child.attr('old_id'), position: child.attr('position') };
    2929                response.data = jQuery( 'response_data', child ).text();
    30                 successmsg += response.data;
     30                if ( jQuery( 'body' ).hasClass( 'edit-tags-php' ) ) {
     31                    successmsg += response.data;
     32                }
    3133                response.supplemental = {};
    3234                if ( !jQuery( 'supplemental', child ).children().each( function() {
     
    5153                re.html( '<div class="error">' + err + '</div>' );
    5254                wp.a11y.speak( err );
    53             } else {
     55            } else if ( successmsg.length ) {
    5456                re.html( '<div class="updated notice is-dismissible"><p>' + successmsg + '</p></div>');
    5557                jQuery(document).trigger( 'wp-updates-notice-added' );
Note: See TracChangeset for help on using the changeset viewer.