Bundled Themes: Avoid loading translations too early.

Load block patterns for bundled themes on the `init` hook to avoid triggering notices caused by loading the translations too early.

The change is applied to Twenty Ten, Twenty Twelve, Twenty Thirteen, Twenty Fourteen, Twenty Fifteen, Twenty Sixteen and Twenty Twenty.

Props domainsupport, swissspidy.
Fixes #62237.
See #44937.

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


git-svn-id: http://core.svn.wordpress.org/trunk@58636 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Peter Wilson 2024-10-17 00:37:17 +00:00
parent 172d5084a4
commit 3c5699206b
10 changed files with 78 additions and 21 deletions

View File

@ -657,8 +657,12 @@ require get_template_directory() . '/inc/template-tags.php';
require get_template_directory() . '/inc/customizer.php'; require get_template_directory() . '/inc/customizer.php';
/** /**
* Block Patterns. * Register block patterns and pattern categories.
* *
* @since Twenty Fifteen 3.0 * @since Twenty Fifteen 3.9
*/ */
require get_template_directory() . '/inc/block-patterns.php'; function twentyfifteen_register_block_patterns() {
require get_template_directory() . '/inc/block-patterns.php';
}
add_action( 'init', 'twentyfifteen_register_block_patterns' );

View File

@ -728,8 +728,16 @@ require get_template_directory() . '/inc/template-tags.php';
// Add Customizer functionality. // Add Customizer functionality.
require get_template_directory() . '/inc/customizer.php'; require get_template_directory() . '/inc/customizer.php';
// Add support for block patterns. /**
require get_template_directory() . '/inc/block-patterns.php'; * Register block patterns and pattern categories.
*
* @since Twenty Fourteen 4.1
*/
function twentyfourteen_register_block_patterns() {
require get_template_directory() . '/inc/block-patterns.php';
}
add_action( 'init', 'twentyfourteen_register_block_patterns' );
/* /*
* Add Featured Content functionality. * Add Featured Content functionality.

View File

@ -384,6 +384,12 @@ require get_template_directory() . '/inc/template-tags.php';
require get_template_directory() . '/inc/customizer.php'; require get_template_directory() . '/inc/customizer.php';
/** /**
* Block Patterns. * Register block patterns and pattern categories.
*
* @since Twenty Nineteen 3.0
*/ */
require get_template_directory() . '/inc/block-patterns.php'; function twentynineteen_register_block_patterns() {
require get_template_directory() . '/inc/block-patterns.php';
}
add_action( 'init', 'twentynineteen_register_block_patterns' );

View File

@ -737,6 +737,12 @@ require get_parent_theme_file_path( '/inc/customizer.php' );
require get_parent_theme_file_path( '/inc/icon-functions.php' ); require get_parent_theme_file_path( '/inc/icon-functions.php' );
/** /**
* Block Patterns. * Register block patterns and pattern categories.
*
* @since Twenty Seventeen 3.8
*/ */
require get_template_directory() . '/inc/block-patterns.php'; function twentyseventeen_register_block_patterns() {
require get_template_directory() . '/inc/block-patterns.php';
}
add_action( 'init', 'twentyseventeen_register_block_patterns' );

View File

@ -528,10 +528,17 @@ function twentysixteen_hex2rgb( $color ) {
*/ */
require get_template_directory() . '/inc/template-tags.php'; require get_template_directory() . '/inc/template-tags.php';
/** /**
* Block Patterns. * Register block patterns and pattern categories.
*
* @since Twenty Sixteen 3.4
*/ */
require get_template_directory() . '/inc/block-patterns.php'; function twentysixteen_register_block_patterns() {
require get_template_directory() . '/inc/block-patterns.php';
}
add_action( 'init', 'twentysixteen_register_block_patterns' );
/** /**
* Customizer additions. * Customizer additions.

View File

@ -781,8 +781,16 @@ function twentyten_block_editor_styles() {
} }
add_action( 'enqueue_block_editor_assets', 'twentyten_block_editor_styles' ); add_action( 'enqueue_block_editor_assets', 'twentyten_block_editor_styles' );
// Block Patterns. /**
require get_template_directory() . '/block-patterns.php'; * Register block patterns and pattern categories.
*
* @since Twenty Ten 4.3
*/
function twentyten_register_block_patterns() {
require get_template_directory() . '/block-patterns.php';
}
add_action( 'init', 'twentyten_register_block_patterns' );
if ( ! function_exists( 'wp_body_open' ) ) : if ( ! function_exists( 'wp_body_open' ) ) :
/** /**

View File

@ -46,11 +46,15 @@ if ( version_compare( $GLOBALS['wp_version'], '3.6-alpha', '<' ) ) {
} }
/** /**
* Block Patterns. * Register block patterns and pattern categories.
* *
* @since Twenty Thirteen 3.4 * @since Twenty Thirteen 4.3
*/ */
require get_template_directory() . '/inc/block-patterns.php'; function twentythirteen_register_block_patterns() {
require get_template_directory() . '/inc/block-patterns.php';
}
add_action( 'init', 'twentythirteen_register_block_patterns' );
/** /**
* Twenty Thirteen setup. * Twenty Thirteen setup.

View File

@ -140,9 +140,15 @@ add_action( 'after_setup_theme', 'twentytwelve_setup' );
require get_template_directory() . '/inc/custom-header.php'; require get_template_directory() . '/inc/custom-header.php';
/** /**
* Add block patterns. * Register block patterns and pattern categories.
*
* @since Twenty Twelve 4.4
*/ */
require get_template_directory() . '/inc/block-patterns.php'; function twentytwelve_register_block_patterns() {
require get_template_directory() . '/inc/block-patterns.php';
}
add_action( 'init', 'twentytwelve_register_block_patterns' );
if ( ! function_exists( 'twentytwelve_get_font_url' ) ) : if ( ! function_exists( 'twentytwelve_get_font_url' ) ) :
/** /**

View File

@ -175,8 +175,16 @@ require get_template_directory() . '/classes/class-twentytwenty-non-latin-langua
// Custom CSS. // Custom CSS.
require get_template_directory() . '/inc/custom-css.php'; require get_template_directory() . '/inc/custom-css.php';
// Block Patterns. /**
require get_template_directory() . '/inc/block-patterns.php'; * Register block patterns and pattern categories.
*
* @since Twenty Twenty 2.8
*/
function twentytwenty_register_block_patterns() {
require get_template_directory() . '/inc/block-patterns.php';
}
add_action( 'init', 'twentytwenty_register_block_patterns' );
/** /**
* Register and Enqueue Styles. * Register and Enqueue Styles.

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.7-beta3-59243'; $wp_version = '6.7-beta3-59244';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.