Skip to:
Content

BuddyPress.org

Changeset 14188


Ignore:
Timestamp:
12/30/2025 07:24:57 PM (7 weeks ago)
Author:
espellcaste
Message:

Load block styles on demand in classic themes.

WordPress 6.9 introduced the wp_before_include_template hook as part of template-loader.php template to enable output buffering for block style hoisting.

Since BuddyPress bypasses template-loader.php when loading templates, we need to integrate this optimization, by hooking it directly.

Developed in https://github.com/buddypress/buddypress/pull/430

Props vapvarun.

See #9309 (14.0)

Location:
branches/14.0/src/bp-core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/14.0/src/bp-core/bp-core-catchuri.php

    r13904 r14188  
    4949 */
    5050function bp_core_enable_root_profiles() {
    51 
    5251    $retval = false;
    5352
     
    155154        $wp_query->is_404      = false;
    156155
    157         // Check if a BuddyPress component's direcory is set as homepage.
     156        // Check if a BuddyPress component's directory is set as homepage.
    158157        $wp_query->is_home = bp_is_directory_homepage( bp_current_component() );
    159158
     
    174173         * @param string $located_template Template found to be loaded.
    175174         */
    176         load_template( apply_filters( 'bp_load_template', $located_template ) );
     175        $bp_load_template = apply_filters( 'bp_load_template', $located_template );
     176
     177        load_template( $bp_load_template );
    177178
    178179        /**
  • branches/14.0/src/bp-core/bp-core-filters.php

    r14182 r14188  
    7272add_filter( 'bp_template_include', 'bp_template_include_theme_supports', 2, 1 );
    7373add_filter( 'bp_template_include', 'bp_template_include_theme_compat', 4, 2 );
     74
     75/**
     76 * Load block styles on demand in classic themes.
     77 *
     78 * WordPress 6.9 introduced the `wp_before_include_template` hook as part of `template-loader.php` template
     79 * to enable output buffering for block style hoisting.
     80 *
     81 * Since BuddyPress bypasses `template-loader.php` when loading templates, we need to
     82 * integrate this optimization, by hooking it directly.
     83 *
     84 * @todo Remove this once we support templates using the template-loader.php.
     85 *
     86 * @since 14.5.0
     87 *
     88 * @link https://buddypress.trac.wordpress.org/ticket/9309
     89 * @link https://core.trac.wordpress.org/ticket/64099
     90 */
     91add_action( 'bp_core_pre_load_template', 'wp_start_template_enhancement_output_buffer', 1000 ); // Late priority to let `wp_template_enhancement_output_buffer` filters and `wp_finalized_template_enhancement_output_buffer` actions be registered.
    7492
    7593// Filter BuddyPress template locations.
Note: See TracChangeset for help on using the changeset viewer.