Make WordPress Core


Ignore:
Timestamp:
01/05/2026 04:31:14 AM (10 months ago)
Author:
westonruter
Message:

Code Modernization: REST API: Use null coalescing operator in place of isset() in 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 [61424], [61404], [61403].

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php

    r59970 r61429  
    580580                        $changes->post_status = 'publish';
    581581                        $changes->tax_input   = array(
    582                                 'wp_theme' => isset( $request['theme'] ) ? $request['theme'] : get_stylesheet(),
     582                                'wp_theme' => $request['theme'] ?? get_stylesheet(),
    583583                        );
    584584                } elseif ( 'custom' !== $template->source ) {
    … …  
    915915                                        return $plugins[ $plugin_basename ]['Name'];
    916916                                }
    917                                 return isset( $template_object->plugin ) ?
    918                                         $template_object->plugin :
     917                                return $template_object->plugin ??
    919918                                        $template_object->theme;
    920919                        case 'site':
Note: See TracChangeset for help on using the changeset viewer.