Skip to content

Commit 6a891c7

Browse files
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
1 parent 8f40982 commit 6a891c7

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/wp-includes/theme.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,14 +1437,16 @@ function is_random_header_image( $type = 'any' ) {
14371437
if ( 'any' === $type ) {
14381438
if ( 'random-default-image' === $header_image_mod
14391439
|| 'random-uploaded-image' === $header_image_mod
1440-
|| ( '' !== get_random_header_image() && empty( $header_image_mod ) )
1440+
|| ( empty( $header_image_mod ) && '' !== get_random_header_image() )
14411441
) {
14421442
return true;
14431443
}
14441444
} else {
14451445
if ( "random-$type-image" === $header_image_mod ) {
14461446
return true;
1447-
} elseif ( 'default' === $type && empty( $header_image_mod ) && '' !== get_random_header_image() ) {
1447+
} elseif ( 'default' === $type
1448+
&& empty( $header_image_mod ) && '' !== get_random_header_image()
1449+
) {
14481450
return true;
14491451
}
14501452
}

0 commit comments

Comments
 (0)