Make WordPress Core


Ignore:
Timestamp:
09/17/2023 03:21:07 PM (3 years ago)
Author:
costdev
Message:

Administration: Use wp_admin_notice() more in /wp-admin/includes/.

Adds further usages of wp_admin_notice() in /wp-admin/includes/ on .notice-error, .notice-warning, .error, and .updated.

Ongoing task to implement new function across core.

Follow-up to [56408], [56409], [56410], [56518], [56570], [56571], [56572], [56573], [56576], [56589], [56590], [56597].

Props joedolson, mukesh27, costdev.
See #57791.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-bulk-upgrader-skin.php

    r56027 r56599  
    144144        if ( $this->error || ! $this->result ) {
    145145            if ( $this->error ) {
    146                 echo '<div class="error"><p>' . sprintf( $this->upgrader->strings['skin_update_failed_error'], $title, '<strong>' . $this->error . '</strong>' ) . '</p></div>';
     146                $after_error_message = sprintf( $this->upgrader->strings['skin_update_failed_error'], $title, '<strong>' . $this->error . '</strong>' );
    147147            } else {
    148                 echo '<div class="error"><p>' . sprintf( $this->upgrader->strings['skin_update_failed'], $title ) . '</p></div>';
     148                $after_error_message = sprintf( $this->upgrader->strings['skin_update_failed'], $title );
    149149            }
     150            wp_admin_notice(
     151                $after_error_message,
     152                array(
     153                    'additional_classes' => array( 'error' ),
     154                )
     155            );
    150156
    151157            echo '<script type="text/javascript">jQuery(\'#progress-' . esc_js( $this->upgrader->update_current ) . '\').show();</script>';
Note: See TracChangeset for help on using the changeset viewer.