Skip to content

Commit

Permalink
Bundled Themes: Avoid loading translations too early.
Browse files Browse the repository at this point in the history
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.


git-svn-id: https://develop.svn.wordpress.org/trunk@59244 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
peterwilsoncc committed Oct 17, 2024
1 parent 787e52f commit 333272d
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 20 deletions.
10 changes: 7 additions & 3 deletions src/wp-content/themes/twentyfifteen/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -657,8 +657,12 @@ function twentyfifteen_author_bio_template( $template ) {
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' );
12 changes: 10 additions & 2 deletions src/wp-content/themes/twentyfourteen/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -728,8 +728,16 @@ function twentyfourteen_widget_tag_cloud_args( $args ) {
// Add Customizer functionality.
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.
Expand Down
10 changes: 8 additions & 2 deletions src/wp-content/themes/twentynineteen/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,12 @@ function twentynineteen_colors_css_wrap() {
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' );
10 changes: 8 additions & 2 deletions src/wp-content/themes/twentyseventeen/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,12 @@ function twentyseventeen_should_show_featured_image() {
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' );
11 changes: 9 additions & 2 deletions src/wp-content/themes/twentysixteen/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -528,10 +528,17 @@ function twentysixteen_hex2rgb( $color ) {
*/
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.
Expand Down
12 changes: 10 additions & 2 deletions src/wp-content/themes/twentyten/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -781,8 +781,16 @@ function 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' ) ) :
/**
Expand Down
10 changes: 7 additions & 3 deletions src/wp-content/themes/twentythirteen/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,15 @@
}

/**
* 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.
Expand Down
10 changes: 8 additions & 2 deletions src/wp-content/themes/twentytwelve/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,15 @@ function twentytwelve_setup() {
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' ) ) :
/**
Expand Down
12 changes: 10 additions & 2 deletions src/wp-content/themes/twentytwenty/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,16 @@ function twentytwenty_theme_support() {
// Custom CSS.
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.
Expand Down

0 comments on commit 333272d

Please sign in to comment.