Make WordPress Core


Ignore:
Timestamp:
06/06/2024 08:00:08 AM (8 months ago)
Author:
oandregal
Message:

Editor: code quality improvements for theme.json migrate API

Backports https://github.com/WordPress/gutenberg/pull/62305

Follow-up to [58328], #61282.

Props ajlende, oandregal, ramonopoly, mukesh27.
Fixes #61282.

File:
1 edited

Legend:

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

    r58339 r58354  
    526526                $decoded_data['isGlobalStylesUserThemeJSON']
    527527            ) {
     528                unset( $decoded_data['isGlobalStylesUserThemeJSON'] );
    528529                $config = $decoded_data;
    529530            }
     
    531532
    532533        /** This filter is documented in wp-includes/class-wp-theme-json-resolver.php */
    533         $theme_json = apply_filters( 'wp_theme_json_data_user', new WP_Theme_JSON_Data( $config, 'custom' ) );
    534         $config     = $theme_json->get_data();
    535 
    536         // Needs to be set for schema migrations of user data.
    537         $config['isGlobalStylesUserThemeJSON'] = true;
    538 
    539         static::$user = new WP_Theme_JSON( $config, 'custom' );
     534        $theme_json   = apply_filters( 'wp_theme_json_data_user', new WP_Theme_JSON_Data( $config, 'custom' ) );
     535        static::$user = $theme_json->get_theme_json();
    540536
    541537        return static::$user;
Note: See TracChangeset for help on using the changeset viewer.