Make WordPress Core


Ignore:
Timestamp:
01/06/2026 06:05:20 AM (3 months ago)
Author:
westonruter
Message:

Code Modernization: Taxonomy, Posts/Post Types, Options/Meta APIs, Query, General: Use null coalescing operator instead of isset() ternaries.

Developed as a subset of https://github.com/WordPress/wordpress-develop/pull/10654
Initially developed in https://github.com/WordPress/wordpress-develop/pull/4886

Follow-up to [61444], [61443], [61442], [61436], [61435], [61434], [61403], [61433], [61432], [61431], [61430], [61429], [61424], [61404], [61403].

Props costdev, westonruter.
See #58874, #63430.

File:
1 edited

Legend:

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

    r61440 r61445  
    430430        }
    431431
    432         $attachment_data = isset( $post_data['attachments'][ $post_id ] ) ? $post_data['attachments'][ $post_id ] : array();
     432        $attachment_data = $post_data['attachments'][ $post_id ] ?? array();
    433433
    434434        /** This filter is documented in wp-admin/includes/media.php */
     
    10151015    $metakeyselect = isset( $_POST['metakeyselect'] ) ? wp_unslash( trim( $_POST['metakeyselect'] ) ) : '';
    10161016    $metakeyinput  = isset( $_POST['metakeyinput'] ) ? wp_unslash( trim( $_POST['metakeyinput'] ) ) : '';
    1017     $metavalue     = isset( $_POST['metavalue'] ) ? $_POST['metavalue'] : '';
     1017    $metavalue     = $_POST['metavalue'] ?? '';
    10181018    if ( is_string( $metavalue ) ) {
    10191019        $metavalue = trim( $metavalue );
     
    20442044     * this is hooked on inner core hooks where a valid nonce was already checked.
    20452045     */
    2046     $posted_data = isset( $_POST['data']['wp_autosave'] ) ? $_POST['data']['wp_autosave'] : $_POST;
     2046    $posted_data = $_POST['data']['wp_autosave'] ?? $_POST;
    20472047
    20482048    $post_type = get_post_type( $new_autosave['post_parent'] );
Note: See TracChangeset for help on using the changeset viewer.