From 44881d209b2f37cccdbd1f9a8713ba782bbdb65f Mon Sep 17 00:00:00 2001 From: davidbaumwald Date: Thu, 27 Oct 2022 16:34:12 +0000 Subject: [PATCH] Themes: Ensure custom global styles are imported properly. This change removes caching of global styles for logged in users, allowing "wp_global_styles" custom post type to be imported completely, regardless of any previously cached data. This change now relies on the lower-level native `WP_Query` cache invalidation methods for the global styles post type. Follow-up to [52275], [54186]. Props anariel-design, bernhard-reiter, andrewserong, spacedmonkey, andraganescu, peterwilsoncc, oandregal, hellofromTonya. Fixes #56901. Built from https://develop.svn.wordpress.org/trunk@54706 git-svn-id: http://core.svn.wordpress.org/trunk@54258 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-theme-json-resolver.php | 13 ------------- wp-includes/version.php | 2 +- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/wp-includes/class-wp-theme-json-resolver.php b/wp-includes/class-wp-theme-json-resolver.php index 18b997561c..ee153eb657 100644 --- a/wp-includes/class-wp-theme-json-resolver.php +++ b/wp-includes/class-wp-theme-json-resolver.php @@ -423,17 +423,6 @@ class WP_Theme_JSON_Resolver { ), ); - $cache_key = sprintf( 'wp_global_styles_%s', md5( serialize( $args ) ) ); - $post_id = (int) get_transient( $cache_key ); - // Special case: '-1' is a results not found. - if ( -1 === $post_id && ! $create_post ) { - return $user_cpt; - } - - if ( $post_id > 0 && in_array( get_post_status( $post_id ), (array) $post_status_filter, true ) ) { - return get_post( $post_id, ARRAY_A ); - } - $global_style_query = new WP_Query(); $recent_posts = $global_style_query->query( $args ); if ( count( $recent_posts ) === 1 ) { @@ -456,8 +445,6 @@ class WP_Theme_JSON_Resolver { $user_cpt = get_post( $cpt_post_id, ARRAY_A ); } } - $cache_expiration = $user_cpt ? DAY_IN_SECONDS : HOUR_IN_SECONDS; - set_transient( $cache_key, $user_cpt ? $user_cpt['ID'] : -1, $cache_expiration ); return $user_cpt; } diff --git a/wp-includes/version.php b/wp-includes/version.php index fdb75a7396..c909d2c35e 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.2-alpha-54704'; +$wp_version = '6.2-alpha-54706'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.