Aggregate inline JS on specific page

[ad_1]

you can disable “aggregate inline JS” with a filter;

add_filter('autoptimize_js_include_inline', '__return_false' );

so based on that you can do something like;

add_filter('autoptimize_js_include_inline', function( $state ) {
  if ( true === $example_condition ) {
    return false;
  }

return true;  
} );

so if you change the $example_condition to something relevant for identifying a page (based on URL or page ID) , you could use that?

Hello,

It works! Except that the first return must be true and the second false.

Thank you!

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer