Skip to:
Content

BuddyPress.org

Changeset 14189


Ignore:
Timestamp:
12/30/2025 07:26:53 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.

Props vapvarun.

Closes https://github.com/buddypress/buddypress/pull/430
Fixes #9309 (trunk)

Location:
trunk/src/bp-core
Files:
2 edited

Legend:

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

    r14068 r14189  
    5555 */
    5656function bp_core_enable_root_profiles() {
    57 
    5857    $retval = false;
    5958
     
    161160        $wp_query->is_404      = false;
    162161
    163         // Check if a BuddyPress component's direcory is set as homepage.
     162        // Check if a BuddyPress component's directory is set as homepage.
    164163        $wp_query->is_home = bp_is_directory_homepage( bp_current_component() );
    165164
     
    180179         * @param string $located_template Template found to be loaded.
    181180         */
    182         load_template( apply_filters( 'bp_load_template', $located_template ) );
     181        $bp_load_template = apply_filters( 'bp_load_template', $located_template );
     182
     183        load_template( $bp_load_template );
    183184
    184185        /**
  • trunk/src/bp-core/bp-core-filters.php

    r14183 r14189  
    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.