From 6a891c736533417deb3be8940ecc89f71c80b455 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 27 Nov 2023 09:15:56 +0000 Subject: [PATCH] Coding Standards: Reorder conditionals in `is_random_header_image()`. This aims to slightly improve performance by checking the faster `empty()` language construct first and potentially avoiding an unnecessary function call. Additionally, this better matches a similar conditional a few lines below. Follow-up to [17757], [17770]. Props Cybr. See #59650. git-svn-id: https://develop.svn.wordpress.org/trunk@57139 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/theme.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php index 89fccddd37..f063bc97a0 100644 --- a/src/wp-includes/theme.php +++ b/src/wp-includes/theme.php @@ -1437,14 +1437,16 @@ function is_random_header_image( $type = 'any' ) { if ( 'any' === $type ) { if ( 'random-default-image' === $header_image_mod || 'random-uploaded-image' === $header_image_mod - || ( '' !== get_random_header_image() && empty( $header_image_mod ) ) + || ( empty( $header_image_mod ) && '' !== get_random_header_image() ) ) { return true; } } else { if ( "random-$type-image" === $header_image_mod ) { return true; - } elseif ( 'default' === $type && empty( $header_image_mod ) && '' !== get_random_header_image() ) { + } elseif ( 'default' === $type + && empty( $header_image_mod ) && '' !== get_random_header_image() + ) { return true; } }