Make WordPress Core

Changeset 59244


Ignore:
Timestamp:
10/17/2024 12:35:01 AM (2 months ago)
Author:
peterwilsoncc
Message:

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.

Location:
trunk/src/wp-content/themes
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyfifteen/functions.php

    r58718 r59244  
    658658
    659659/**
    660  * Block Patterns.
    661  *
    662  * @since Twenty Fifteen 3.0
    663  */
    664 require get_template_directory() . '/inc/block-patterns.php';
     660 * Register block patterns and pattern categories.
     661 *
     662 * @since Twenty Fifteen 3.9
     663 */
     664function twentyfifteen_register_block_patterns() {
     665    require get_template_directory() . '/inc/block-patterns.php';
     666}
     667
     668add_action( 'init', 'twentyfifteen_register_block_patterns' );
  • trunk/src/wp-content/themes/twentyfourteen/functions.php

    r58718 r59244  
    729729require get_template_directory() . '/inc/customizer.php';
    730730
    731 // Add support for block patterns.
    732 require get_template_directory() . '/inc/block-patterns.php';
     731/**
     732 * Register block patterns and pattern categories.
     733 *
     734 * @since Twenty Fourteen 4.1
     735 */
     736function twentyfourteen_register_block_patterns() {
     737    require get_template_directory() . '/inc/block-patterns.php';
     738}
     739
     740add_action( 'init', 'twentyfourteen_register_block_patterns' );
    733741
    734742/*
  • trunk/src/wp-content/themes/twentynineteen/functions.php

    r56935 r59244  
    385385
    386386/**
    387  * Block Patterns.
    388  */
    389 require get_template_directory() . '/inc/block-patterns.php';
     387 * Register block patterns and pattern categories.
     388 *
     389 * @since Twenty Nineteen 3.0
     390 */
     391function twentynineteen_register_block_patterns() {
     392    require get_template_directory() . '/inc/block-patterns.php';
     393}
     394
     395add_action( 'init', 'twentynineteen_register_block_patterns' );
  • trunk/src/wp-content/themes/twentyseventeen/functions.php

    r58718 r59244  
    738738
    739739/**
    740  * Block Patterns.
    741  */
    742 require get_template_directory() . '/inc/block-patterns.php';
     740 * Register block patterns and pattern categories.
     741 *
     742 * @since Twenty Seventeen 3.8
     743 */
     744function twentyseventeen_register_block_patterns() {
     745    require get_template_directory() . '/inc/block-patterns.php';
     746}
     747
     748add_action( 'init', 'twentyseventeen_register_block_patterns' );
  • trunk/src/wp-content/themes/twentysixteen/functions.php

    r58718 r59244  
    529529require get_template_directory() . '/inc/template-tags.php';
    530530
    531 /**
    532  * Block Patterns.
    533  */
    534 require get_template_directory() . '/inc/block-patterns.php';
     531
     532/**
     533 * Register block patterns and pattern categories.
     534 *
     535 * @since Twenty Sixteen 3.4
     536 */
     537function twentysixteen_register_block_patterns() {
     538    require get_template_directory() . '/inc/block-patterns.php';
     539}
     540
     541add_action( 'init', 'twentysixteen_register_block_patterns' );
    535542
    536543/**
  • trunk/src/wp-content/themes/twentyten/functions.php

    r59219 r59244  
    782782add_action( 'enqueue_block_editor_assets', 'twentyten_block_editor_styles' );
    783783
    784 // Block Patterns.
    785 require get_template_directory() . '/block-patterns.php';
     784/**
     785 * Register block patterns and pattern categories.
     786 *
     787 * @since Twenty Ten 4.3
     788 */
     789function twentyten_register_block_patterns() {
     790    require get_template_directory() . '/block-patterns.php';
     791}
     792
     793add_action( 'init', 'twentyten_register_block_patterns' );
    786794
    787795if ( ! function_exists( 'wp_body_open' ) ) :
  • trunk/src/wp-content/themes/twentythirteen/functions.php

    r58718 r59244  
    4747
    4848/**
    49  * Block Patterns.
    50  *
    51  * @since Twenty Thirteen 3.4
    52  */
    53 require get_template_directory() . '/inc/block-patterns.php';
     49 * Register block patterns and pattern categories.
     50 *
     51 * @since Twenty Thirteen 4.3
     52 */
     53function twentythirteen_register_block_patterns() {
     54    require get_template_directory() . '/inc/block-patterns.php';
     55}
     56
     57add_action( 'init', 'twentythirteen_register_block_patterns' );
    5458
    5559/**
  • trunk/src/wp-content/themes/twentytwelve/functions.php

    r58718 r59244  
    141141
    142142/**
    143  * Add block patterns.
    144  */
    145 require get_template_directory() . '/inc/block-patterns.php';
     143 * Register block patterns and pattern categories.
     144 *
     145 * @since Twenty Twelve 4.4
     146 */
     147function twentytwelve_register_block_patterns() {
     148    require get_template_directory() . '/inc/block-patterns.php';
     149}
     150
     151add_action( 'init', 'twentytwelve_register_block_patterns' );
    146152
    147153if ( ! function_exists( 'twentytwelve_get_font_url' ) ) :
  • trunk/src/wp-content/themes/twentytwenty/functions.php

    r57842 r59244  
    176176require get_template_directory() . '/inc/custom-css.php';
    177177
    178 // Block Patterns.
    179 require get_template_directory() . '/inc/block-patterns.php';
     178/**
     179 * Register block patterns and pattern categories.
     180 *
     181 * @since Twenty Twenty 2.8
     182 */
     183function twentytwenty_register_block_patterns() {
     184    require get_template_directory() . '/inc/block-patterns.php';
     185}
     186
     187add_action( 'init', 'twentytwenty_register_block_patterns' );
    180188
    181189/**
Note: See TracChangeset for help on using the changeset viewer.