From 4ab1b4ccf0177f67b8d193374d882792ffb7cb9a Mon Sep 17 00:00:00 2001 From: Robert Anderson Date: Wed, 8 Dec 2021 15:05:38 +1100 Subject: [PATCH 1/2] Fix default theme supports By default, block themes should have a few theme supports enabled by default. These are: post-thumbnails, responsive-embeds, editor-styles, html5, automatic-feed-links. This is a backport of https://github.com/WordPress/gutenberg/pull/35593. --- src/wp-includes/default-filters.php | 1 + src/wp-includes/theme.php | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/wp-includes/default-filters.php b/src/wp-includes/default-filters.php index 23b0035d8fb3..79797a08d982 100644 --- a/src/wp-includes/default-filters.php +++ b/src/wp-includes/default-filters.php @@ -514,6 +514,7 @@ */ // Theme. add_action( 'setup_theme', 'create_initial_theme_features', 0 ); +add_action( 'setup_theme', '_add_default_theme_supports', 1 ); add_action( 'wp_loaded', '_custom_header_background_just_in_time' ); add_action( 'wp_head', '_custom_logo_header_styles' ); add_action( 'plugins_loaded', '_wp_customize_include' ); diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php index c1f94428fe6f..d6f1a90edbaf 100644 --- a/src/wp-includes/theme.php +++ b/src/wp-includes/theme.php @@ -4093,3 +4093,21 @@ function create_initial_theme_features() { function wp_is_block_theme() { return wp_get_theme()->is_block_theme(); } + +/** + * Adds default theme supports for block themes when the 'setup_theme' action + * fires. + * + * @since 5.9.0 + * @access private + */ +function _add_default_theme_supports() { + if ( wp_is_block_theme() ) { + add_theme_support( 'post-thumbnails' ); + add_theme_support( 'responsive-embeds' ); + add_theme_support( 'editor-styles' ); + add_theme_support( 'html5', array( 'style', 'script' ) ); + add_theme_support( 'automatic-feed-links' ); + add_filter( 'should_load_separate_core_block_assets', '__return_true' ); + } +} From f76914f751adcf0505e6df22f4d5ad8a7a07b3f4 Mon Sep 17 00:00:00 2001 From: Tonya Mork Date: Mon, 13 Dec 2021 17:02:09 -0600 Subject: [PATCH 2/2] Add `comment-form` and `comment-list` to theme supports. Co-authored-by: Dominik Schilling --- src/wp-includes/theme.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php index d6f1a90edbaf..b16ab60ef68b 100644 --- a/src/wp-includes/theme.php +++ b/src/wp-includes/theme.php @@ -4106,7 +4106,7 @@ function _add_default_theme_supports() { add_theme_support( 'post-thumbnails' ); add_theme_support( 'responsive-embeds' ); add_theme_support( 'editor-styles' ); - add_theme_support( 'html5', array( 'style', 'script' ) ); + add_theme_support( 'html5', array( 'comment-form', 'comment-list', 'style', 'script' ) ); add_theme_support( 'automatic-feed-links' ); add_filter( 'should_load_separate_core_block_assets', '__return_true' ); }