Make WordPress Core


Ignore:
Timestamp:
11/27/2023 09:15:56 AM (12 months ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/theme.php

    r57129 r57139  
    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;
     
    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        }
Note: See TracChangeset for help on using the changeset viewer.