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-includes/taxonomy.php

    r61387 r61445  
    17241724    $do_object = is_object( $term );
    17251725
    1726     $term_id = $do_object ? $term->term_id : ( isset( $term['term_id'] ) ? $term['term_id'] : 0 );
     1726    $term_id = $do_object ? $term->term_id : ( $term['term_id'] ?? 0 );
    17271727
    17281728    foreach ( (array) $fields as $field ) {
     
    32813281    $parsed_args['slug'] = $slug;
    32823282
    3283     $term_group = isset( $parsed_args['term_group'] ) ? $parsed_args['term_group'] : 0;
     3283    $term_group = $parsed_args['term_group'] ?? 0;
    32843284    if ( $args['alias_of'] ) {
    32853285        $alias = get_term_by( 'slug', $args['alias_of'], $taxonomy );
Note: See TracChangeset for help on using the changeset viewer.