Fallback to the old function name in case users are still on the old version of Gutenberg (#5250)

This commit is contained in:
Ben Dwyer 2021-12-23 01:32:09 +00:00 committed by GitHub
parent 47d758b63f
commit 18c6bcb1f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View file

@ -162,7 +162,12 @@ class GlobalStylesColorCustomizer {
$this->update_user_color_palette( $wp_customize );
// Get the user's theme.json from the CPT.
$user_custom_post_type_id = WP_Theme_JSON_Resolver_Gutenberg::get_user_global_styles_post_id();
if ( method_exists( WP_Theme_JSON_Resolver_Gutenberg, 'get_user_global_styles_post_id' ) ) { // This is the new name.
$user_custom_post_type_id = WP_Theme_JSON_Resolver_Gutenberg::get_user_global_styles_post_id();
} else if ( method_exists( WP_Theme_JSON_Resolver_Gutenberg, 'get_user_custom_post_type_id' ) ) { // This is the old name.
$user_custom_post_type_id = WP_Theme_JSON_Resolver_Gutenberg::get_user_custom_post_type_id();
}
$user_theme_json_post = get_post( $user_custom_post_type_id );
$user_theme_json_post_content = json_decode( $user_theme_json_post->post_content );

View file

@ -505,7 +505,12 @@ class GlobalStylesFontsCustomizer {
$heading_font_family_variable = 'var(--wp--preset--font-family--' . $heading_setting['slug'] . ')';
// Get the user's theme.json from the CPT.
$user_custom_post_type_id = WP_Theme_JSON_Resolver_Gutenberg::get_user_global_styles_post_id();
if ( method_exists( WP_Theme_JSON_Resolver_Gutenberg, 'get_user_global_styles_post_id' ) ) { // This is the new name.
$user_custom_post_type_id = WP_Theme_JSON_Resolver_Gutenberg::get_user_global_styles_post_id();
} else if ( method_exists( WP_Theme_JSON_Resolver_Gutenberg, 'get_user_custom_post_type_id' ) ) { // This is the old name.
$user_custom_post_type_id = WP_Theme_JSON_Resolver_Gutenberg::get_user_custom_post_type_id();
}
$user_theme_json_post = get_post( $user_custom_post_type_id );
$user_theme_json_post_content = json_decode( $user_theme_json_post->post_content );