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 .

git-svn-id: https://develop.svn.wordpress.org/trunk@55853 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2023-05-24 10:13:49 +00:00
parent e1b51684dc
commit d51ee6ce09

@ -279,10 +279,21 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
<hr class="is-large" />
<div class="return-to-dashboard">
<?php if ( current_user_can( 'update_core' ) && isset( $_GET['updated'] ) ) : ?>
<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> |
<?php endif; ?>
<a href="<?php echo esc_url( self_admin_url() ); ?>"><?php is_blog_admin() ? _e( 'Go to Dashboard &rarr; Home' ) : _e( 'Go to Dashboard' ); ?></a>
<?php
if ( isset( $_GET['updated'] ) && current_user_can( 'update_core' ) ) {
printf(
'<a href="%1$s">%2$s</a> | ',
esc_url( self_admin_url( 'update-core.php' ) ),
is_multisite() ? __( 'Go to Updates' ) : __( 'Go to Dashboard &rarr; Updates' )
);
}
printf(
'<a href="%1$s">%2$s</a>',
esc_url( self_admin_url() ),
is_blog_admin() ? __( 'Go to Dashboard &rarr; Home' ) : __( 'Go to Dashboard' )
);
?>
</div>
</div>