Suppress Beaver Builder javascript and css on certain pages

Hi,
I’m developing a theme with a custom front-page.php and using Beaver Builder as a plugin for posts. I’m not using Beaver Builder at all on the home page and I’d like to prevent the css and javascript files from getting pulled in for a faster page load and to prevent code and style conflicts. Is there an easy way to disassociate just that page from Beaver Builder so that those files don’t get auto-created OR is there an easy way to suppress those scripts/css in the backend? I’ve perused the developer documentation, these forums, and the Beaver Builder code itself but haven’t found an easy way yet.

Thanks,
Eric

Hey Eric,

Sorry, my response earlier was a bit hasty. We’ve already assigned another member of the team to assist you with your concern. :slight_smile:

Ben

Hi Drew,

Beaver Builder’s CSS/JS should only be loading on pages that were built with it. Is that not the case for you? If so, would you mind sending temporary admin access for us to check it out?

Thanks,
Justin

[Content Hidden]

Thanks! Just emailed.

Hey Eric,

Following up here so everyone can see this. The issue is that posts in the archive feed on the homepage are using the builder. So the assets are getting loaded for those since BB assets are loaded for every post in the loop that has a builder layout.

We’ve run into issues with this before, on both sides of the coin. Disabling asset loading on archives works for some, but causes issues with other use cases.

Until we come up with a solution, you can add this to your functions.php file to prevent loading on whatever page you want…

if ( is_archive() ) {
    remove_action( 'wp_enqueue_scripts', 'FLBuilder::layout_styles_scripts' );
}

You could also use is_front_page to only prevent loading on your front page and not other archive pages.

Let me know if you have any questions about that.

Thanks,
Justin

That worked like a charm. Thanks Justin. Now the only question is when is this trick going to show up in the developer docs :wink:

Great! Thanks for the suggestion, since we don’t have a solution yet, I’ll definitely get this in the docs.

Justin