Make WordPress Core


Ignore:
Timestamp:
09/14/2023 12:52:45 AM (3 years ago)
Author:
joedolson
Message:

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

Add usages of wp_admin_notice() and wp_get_admin_notice() on .notice-[type] in the root level of /wp-admin/. Ongoing task to implement new function across core.

Props costdev, joedolson.
See #57791.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/update-core.php

    r56548 r56570  
    256256                echo '</h2>';
    257257
    258                 echo '<div class="notice notice-warning inline"><p>';
    259                 printf(
     258                $message = sprintf(
    260259                        /* translators: 1: Documentation on WordPress backups, 2: Documentation on updating WordPress. */
    261260                        __( '<strong>Important:</strong> Before updating, please <a href="%1$s">back up your database and files</a>. For help with updates, visit the <a href="%2$s">Updating WordPress</a> documentation page.' ),
     
    263262                        __( 'https://wordpress.org/documentation/article/updating-wordpress/' )
    264263                );
    265                 echo '</p></div>';
     264                wp_admin_notice(
     265                        $message,
     266                        array(
     267                                'type'               => 'warning',
     268                                'additional_classes' => array( 'inline' ),
     269                        )
     270                );
    266271        } elseif ( $is_development_version ) {
    267272                echo '<h2 class="response">' . __( 'You are using a development version of WordPress.' ) . '</h2>';
     
    303308                if ( 'enabled' === $_GET['core-major-auto-updates-saved'] ) {
    304309                        $notice_text = __( 'Automatic updates for all WordPress versions have been enabled. Thank you!' );
    305                         echo '<div class="notice notice-success is-dismissible"><p>' . $notice_text . '</p></div>';
     310                        wp_admin_notice(
     311                                $notice_text,
     312                                array(
     313                                        'type'        => 'success',
     314                                        'dismissible' => true,
     315                                )
     316                        );
    306317                } elseif ( 'disabled' === $_GET['core-major-auto-updates-saved'] ) {
    307318                        $notice_text = __( 'WordPress will only receive automatic security and maintenance releases from now on.' );
    308                         echo '<div class="notice notice-success is-dismissible"><p>' . $notice_text . '</p></div>';
     319                        wp_admin_notice(
     320                                $notice_text,
     321                                array(
     322                                        'type'        => 'success',
     323                                        'dismissible' => true,
     324                                )
     325                        );
    309326                }
    310327        }
Note: See TracChangeset for help on using the changeset viewer.