Editor: Activate missing default theme features for block themes.

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 changeset backports the changes introduced in https://github.com/WordPress/gutenberg/pull/35593.

Props noisysocks, ocean90, youknowriad, audrasjb, hellofromTonya.
Fixes #54597.

Built from https://develop.svn.wordpress.org/trunk@52369


git-svn-id: http://core.svn.wordpress.org/trunk@51961 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2021-12-14 09:49:00 +00:00
parent 1309e62457
commit 9b694a6f49
3 changed files with 19 additions and 1 deletions

View File

@ -514,6 +514,7 @@ add_action( 'init', 'wp_sitemaps_get_server' );
*/
// 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' );

View File

@ -4164,3 +4164,20 @@ 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( 'comment-form', 'comment-list', 'style', 'script' ) );
add_theme_support( 'automatic-feed-links' );
add_filter( 'should_load_separate_core_block_assets', '__return_true' );
}
}

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.9-beta2-52368';
$wp_version = '5.9-beta2-52369';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.