@@ -680,39 +680,20 @@ public static function get_merged_data( $origin = 'custom' ) {
680680
681681 $result = new WP_Theme_JSON();
682682 $result->merge( static::get_core_data() );
683- if ( 'default' = == $origin ) {
684- return static::cache_merged_data( $origin, $result );
683+ if ( 'default' ! == $origin ) {
684+ $result->merge( static::get_block_data() );
685685 }
686-
687- $result->merge( static::get_block_data() );
688- if ( 'blocks' === $origin ) {
689- return static::cache_merged_data( $origin, $result );
686+ if ( 'theme' === $origin || 'custom' === $origin ) {
687+ $result->merge( static::get_theme_data() );
690688 }
691-
692- $result->merge( static::get_theme_data() );
693- if ( 'theme' === $origin ) {
694- return static::cache_merged_data( $origin, $result );
689+ if ( 'custom' === $origin ) {
690+ $result->merge( static::get_user_data() );
695691 }
696692
697- $result->merge( static::get_user_data() );
698- return static::cache_merged_data( $origin, $result );
699- }
700-
701- /**
702- * Stores the merged data for an origin and returns a copy of it.
703- *
704- * Return a clone so callers can modify the result without changing the cache.
705- *
706- * @since 7.2.0
707- *
708- * @param string $origin Origin the data was merged for.
709- * @param WP_Theme_JSON $theme_json Merged data.
710- * @return WP_Theme_JSON Copy of the merged data.
711- */
712- protected static function cache_merged_data( $origin, $theme_json ) {
713- static::$merged[ $origin ] = $theme_json;
693+ static::$merged[ $origin ] = $result;
714694
715- return clone $theme_json;
695+ // Return a clone so callers can modify the result without changing the cache.
696+ return clone $result;
716697 }
717698
718699 /**
0 commit comments