The Divi Builder plugin is a fantastic tool for adding endless layouts to your pages and posts, we use the Divi Builder plugin on this site as it provides a quick and easy way to build rich, beautiful layouts. The downside to Divi Builder is that it comes with a heavy page load on all pages of your site by default even if the page/post isn’t using the builder.
We only use the Divi Builder on certain posts and pages so had no need for the scripts and styles to be enqueued on all pages. We wrote this quick function to dequeue the divi builder scripts unless the page builder is active on the current page/post.
Divi Page Builder Dequeue scripts unless the page builder is active on current page:
function deregister_script() { $is_page_builder_used = et_pb_is_pagebuilder_used( get_the_ID() ); if( !$is_page_builder_used ) { wp_dequeue_script('et-builder-modules-global-functions-script'); wp_dequeue_script('google-maps-api'); wp_dequeue_script('divi-fitvids'); wp_dequeue_script('waypoints'); wp_dequeue_script('magnific-popup'); wp_dequeue_script('hashchange'); wp_dequeue_script('salvattore'); wp_dequeue_script('easypiechart'); wp_dequeue_script('et-jquery-visible-viewport'); wp_dequeue_script('magnific-popup'); wp_dequeue_script('et-jquery-touch-mobile'); wp_dequeue_script('et-builder-modules-script'); } } } add_action( 'wp_print_scripts', 'deregister_script', 100 );
Divi Page Builder Dequeue styles unless the page builder is active on current page:
function deregister_styles() { $is_page_builder_used = et_pb_is_pagebuilder_used( get_the_ID() ); if( !$is_page_builder_used ) { wp_dequeue_style('et-builder-modules-style'); } } add_action( 'wp_print_styles', 'deregister_styles', 100 );
You can place the functions in your theme functions.php file or create a MU plugin for them.
Please note this is for the Divi Builder plugin and not the Divi Theme

Adam
Editor of the Lakewood Journal and the founder of Lakewood media. Also an avid landscape and travel photographer.
You may also like
Beginner’s Guide to Nofollow, Sponsored, and UGC Tags: Understanding and Implementing Proper Link Attributes
In this beginner's guide, we will delve into the specifics of each tag, their purpose, and how to implement them effectively.
0 Comments12 Minutes
How to Recover from a Negative SEO Attack and Protect Your Website
Our SEO team explain the steps you can take to recover from a negative SEO attack and protect your website from future harm.
0 Comments5 Minutes