Make WordPress Core


Ignore:
Timestamp:
05/24/2023 10:13:49 AM (19 months ago)
Author:
SergeyBiryukov
Message:

Help/About: Reverse the order of conditionals for displaying the "Go to Updates" link.

isset() is faster than current_user_can(), so should be checked first.

Includes updating code layout for better readability.

Follow-up to [19442], [19524], [28477], [33466], [55848].

See #57839.

File:
1 edited

Legend:

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

    r55848 r55853  
    280280
    281281        <div class="return-to-dashboard">
    282             <?php if ( current_user_can( 'update_core' ) && isset( $_GET['updated'] ) ) : ?>
    283                 <a href="<?php echo esc_url( self_admin_url( 'update-core.php' ) ); ?>"><?php is_multisite() ? _e( 'Go to Updates' ) : _e( 'Go to Dashboard &rarr; Updates' ); ?></a> |
    284             <?php endif; ?>
    285             <a href="<?php echo esc_url( self_admin_url() ); ?>"><?php is_blog_admin() ? _e( 'Go to Dashboard &rarr; Home' ) : _e( 'Go to Dashboard' ); ?></a>
     282            <?php
     283            if ( isset( $_GET['updated'] ) && current_user_can( 'update_core' ) ) {
     284                printf(
     285                    '<a href="%1$s">%2$s</a> | ',
     286                    esc_url( self_admin_url( 'update-core.php' ) ),
     287                    is_multisite() ? __( 'Go to Updates' ) : __( 'Go to Dashboard &rarr; Updates' )
     288                );
     289            }
     290
     291            printf(
     292                '<a href="%1$s">%2$s</a>',
     293                esc_url( self_admin_url() ),
     294                is_blog_admin() ? __( 'Go to Dashboard &rarr; Home' ) : __( 'Go to Dashboard' )
     295            );
     296            ?>
    286297        </div>
    287298    </div>
Note: See TracChangeset for help on using the changeset viewer.