Make WordPress Core


Ignore:
Timestamp:
09/17/2023 03:21:07 PM (10 months 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-wp-plugin-install-list-table.php

    r56571 r56599  
    291291     */
    292292    public function no_items() {
    293         if ( isset( $this->error ) ) { ?>
    294             <div class="inline error"><p><?php echo $this->error->get_error_message(); ?></p>
    295                 <p class="hide-if-no-js"><button class="button try-again"><?php _e( 'Try Again' ); ?></button></p>
    296             </div>
     293        if ( isset( $this->error ) ) {
     294            $error_message  = '<p>' . $this->error->get_error_message() . '</p>';
     295            $error_message .= '<p class="hide-if-no-js"><button class="button try-again">' . __( 'Try Again' ) . '</button></p>';
     296            wp_admin_notice(
     297                $error_message,
     298                array(
     299                    'additional_classes' => array( 'inline', 'error' ),
     300                    'paragraph_wrap'     => false,
     301                )
     302            );
     303            ?>
    297304        <?php } else { ?>
    298305            <div class="no-plugin-results"><?php _e( 'No plugins found. Try a different search.' ); ?></div>
Note: See TracChangeset for help on using the changeset viewer.