Make WordPress Core


Ignore:
Timestamp:
09/17/2023 03:31:32 PM (3 years ago)
Author:
joedolson
Message:

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

Add additional usage of wp_admin_notice() in wp-admin/ on .error and miscellaneous usages previously overlooked.

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

Props costdev, joedolson.
See #57791.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/async-upload.php

    r52646 r56600  
    114114$id = media_handle_upload( 'async-upload', $post_id );
    115115if ( is_wp_error( $id ) ) {
    116         printf(
    117                 '<div class="error-div error">%s <strong>%s</strong><br />%s</div>',
     116        $message = sprintf(
     117                '%s <strong>%s</strong><br />%s',
    118118                sprintf(
    119119                        '<button type="button" class="dismiss button-link" onclick="jQuery(this).parents(\'div.media-item\').slideUp(200, function(){jQuery(this).remove();});">%s</button>',
    … …  
    126126                ),
    127127                esc_html( $id->get_error_message() )
     128        );
     129        wp_admin_notice(
     130                $message,
     131                array(
     132                        'additional_classes' => array( 'error-div', 'error' ),
     133                        'paragraph_wrap'     => false,
     134                )
    128135        );
    129136        exit;
Note: See TracChangeset for help on using the changeset viewer.