Make WordPress Core


Ignore:
Timestamp:
01/10/2026 05:01:08 AM (4 months ago)
Author:
westonruter
Message:

Code Modernization: Use null coalescing operator instead of isset() with if/else statements.

Developed in https://github.com/WordPress/wordpress-develop/pull/10711

Follow-up to [61457], [61456], [61455], [61454], [61453], [61445], [61444], [61443], [61442], [61436], [61435], [61434], [61403], [61433], [61432], [61431], [61430], [61429], [61424], [61404], [61403].

See #58874, #63430.

File:
1 edited

Legend:

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

    r61457 r61463  
    15301530        $header_index = $header->ID;
    15311531
    1532         $header_images[ $header_index ]                  = array();
    1533         $header_images[ $header_index ]['attachment_id'] = $header->ID;
    1534         $header_images[ $header_index ]['url']           = $url;
    1535         $header_images[ $header_index ]['thumbnail_url'] = $url;
    1536         $header_images[ $header_index ]['alt_text']      = get_post_meta( $header->ID, '_wp_attachment_image_alt', true );
    1537 
    1538         if ( isset( $header_data['attachment_parent'] ) ) {
    1539             $header_images[ $header_index ]['attachment_parent'] = $header_data['attachment_parent'];
    1540         } else {
    1541             $header_images[ $header_index ]['attachment_parent'] = '';
    1542         }
     1532        $header_images[ $header_index ]                      = array();
     1533        $header_images[ $header_index ]['attachment_id']     = $header->ID;
     1534        $header_images[ $header_index ]['url']               = $url;
     1535        $header_images[ $header_index ]['thumbnail_url']     = $url;
     1536        $header_images[ $header_index ]['alt_text']          = get_post_meta( $header->ID, '_wp_attachment_image_alt', true );
     1537        $header_images[ $header_index ]['attachment_parent'] = $header_data['attachment_parent'] ?? '';
    15431538
    15441539        if ( isset( $header_data['width'] ) ) {
Note: See TracChangeset for help on using the changeset viewer.