Disable Font Loading

Hi,

Is there a way to stop BB from loading fonts?

I already have the fonts we use on the site enqueued with our theme and it appears if I try to set a font for any particular module’s typography, a headline, for example, BB also loads the font.

We don’t use BB for the entire site. We use it for certain pages, but for more general pages and posts, we use the standard block editor and theme templates. Dequeuing the font in my theme is not an option, but neither is loading it twice.

Thanks

I think I found my own answer in the developer docs.

// module enqueued google fonts
add_filter( 'fl_builder_google_fonts_pre_enqueue', function( $fonts ) {
    return array();
} );

// takes care of theme enqueues
add_action( 'wp_enqueue_scripts', function() {
    global $wp_styles;
    if ( isset( $wp_styles->queue ) ) {
        foreach ( $wp_styles->queue as $key => $handle ) {
            if ( false !== strpos( $handle, 'fl-builder-google-fonts-' ) ) {
                unset( $wp_styles->queue[ $key ] );
            }
        }
    }
}, 101 );
1 Like