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-custom-background.php

    r56571 r56599  
    257257
    258258        if ( ! empty( $this->updated ) ) {
    259             ?>
    260 <div id="message" class="updated">
    261     <p>
    262             <?php
    263             /* translators: %s: Home URL. */
    264             printf( __( 'Background updated. <a href="%s">Visit your site</a> to see how it looks.' ), esc_url( home_url( '/' ) ) );
    265             ?>
    266     </p>
    267 </div>
    268         <?php } ?>
     259            $updated_message = sprintf(
     260                /* translators: %s: Home URL. */
     261                __( 'Background updated. <a href="%s">Visit your site</a> to see how it looks.' ),
     262                esc_url( home_url( '/' ) )
     263            );
     264            wp_admin_notice(
     265                $updated_message,
     266                array(
     267                    'id'                 => 'message',
     268                    'additional_classes' => array( 'updated' ),
     269                )
     270            );
     271        }
     272        ?>
    269273
    270274<h2><?php _e( 'Background Image' ); ?></h2>
Note: See TracChangeset for help on using the changeset viewer.