Make WordPress Core


Ignore:
Timestamp:
09/14/2023 02:13:42 AM (3 years ago)
Author:
joedolson
Message:

Administration: Use wp_admin_notice() for .updated.

Add usages of wp_admin_notice() and wp_get_admin_notice() on .updated 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/options-general.php

    r56203 r56573  
    140140<?php
    141141$new_admin_email = get_option( 'new_admin_email' );
    142 if ( $new_admin_email && get_option( 'admin_email' ) !== $new_admin_email ) :
    143         ?>
    144         <div class="updated inline">
    145         <p>
    146         <?php
    147                 printf(
    148                         /* translators: %s: New admin email. */
    149                         __( 'There is a pending change of the admin email to %s.' ),
    150                         '<code>' . esc_html( $new_admin_email ) . '</code>'
    151                 );
    152                 printf(
    153                         ' <a href="%1$s">%2$s</a>',
    154                         esc_url( wp_nonce_url( admin_url( 'options.php?dismiss=new_admin_email' ), 'dismiss-' . get_current_blog_id() . '-new_admin_email' ) ),
    155                         __( 'Cancel' )
    156                 );
    157         ?>
    158         </p>
    159         </div>
    160 <?php endif; ?>
     142if ( $new_admin_email && get_option( 'admin_email' ) !== $new_admin_email ) {
     143        $pending_admin_email_message  = sprintf(
     144                /* translators: %s: New admin email. */
     145                __( 'There is a pending change of the admin email to %s.' ),
     146                '<code>' . esc_html( $new_admin_email ) . '</code>'
     147        );
     148        $pending_admin_email_message .= sprintf(
     149                ' <a href="%1$s">%2$s</a>',
     150                esc_url( wp_nonce_url( admin_url( 'options.php?dismiss=new_admin_email' ), 'dismiss-' . get_current_blog_id() . '-new_admin_email' ) ),
     151                __( 'Cancel' )
     152        );
     153        wp_admin_notice(
     154                $pending_admin_email_message,
     155                array(
     156                        'additional_classes' => array( 'updated', 'inline' ),
     157                )
     158        );
     159}
     160?>
    161161</td>
    162162</tr>
Note: See TracChangeset for help on using the changeset viewer.