diff --git a/src/wp-includes/class-wp-theme-json.php b/src/wp-includes/class-wp-theme-json.php index 0458a2be11b7b..2a4e6c8f609f2 100644 --- a/src/wp-includes/class-wp-theme-json.php +++ b/src/wp-includes/class-wp-theme-json.php @@ -1297,11 +1297,7 @@ protected static function remove_keys_not_in_schema( $tree, $schema ) { * @return array Settings per block. */ public function get_settings() { - if ( ! isset( $this->theme_json['settings'] ) ) { - return array(); - } else { - return $this->theme_json['settings']; - } + return $this->theme_json['settings'] ?? array(); } /** @@ -1539,8 +1535,8 @@ public function get_custom_templates() { foreach ( $this->theme_json['customTemplates'] as $item ) { if ( isset( $item['name'] ) ) { $custom_templates[ $item['name'] ] = array( - 'title' => isset( $item['title'] ) ? $item['title'] : '', - 'postTypes' => isset( $item['postTypes'] ) ? $item['postTypes'] : array( 'page' ), + 'title' => $item['title'] ?? '', + 'postTypes' => $item['postTypes'] ?? array( 'page' ), ); } } @@ -1563,8 +1559,8 @@ public function get_template_parts() { foreach ( $this->theme_json['templateParts'] as $item ) { if ( isset( $item['name'] ) ) { $template_parts[ $item['name'] ] = array( - 'title' => isset( $item['title'] ) ? $item['title'] : '', - 'area' => isset( $item['area'] ) ? $item['area'] : '', + 'title' => $item['title'] ?? '', + 'area' => $item['area'] ?? '', ); } }