Make WordPress Core


Ignore:
Timestamp:
10/17/2024 12:35:01 AM (9 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.