Stop Beaver Builder Loading Font Awesome for Visitors
Removes the Font Awesome icon stylesheets that Beaver Builder loads on the front end, for sites whose layouts use no Font Awesome icons.
Opens WPIDE on
Code
// Stylesheet handles to remove.
$wpide_bb_icon_handles = array( 'font-awesome', 'font-awesome-5' );
add_action( 'wp_enqueue_scripts', function () use ( $wpide_bb_icon_handles ) {
if ( is_user_logged_in() || isset( $_GET['fl_builder'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
return;
}
foreach ( $wpide_bb_icon_handles as $handle ) {
wp_dequeue_style( $handle );
}
}, 999 );
Notes
Check your pages after enabling it: any Font Awesome icons in modules will disappear. Logged-in users keep the icons so the builder works.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.