• Resolved alekv

    (@alekv)


    Hi

    Is there a way to use a filter to exclude certain JavaScript files and inline JavaScript from optimization?

    Thanks
    Aleksandar

Viewing 6 replies - 1 through 6 (of 6 total)
  • @alekv You can exclude the JS from WP-Optimize > Minify > Javascript > Exclude JavaScript from processing

    Thread Starter alekv

    (@alekv)

    I know, but I need to do it in a third party plugin with a filter.

    @alekv I’ll check this with our development team and check with them if there’s a filter/hook to exclude JS files

    Thread Starter alekv

    (@alekv)

    ok

    @alekv Sorry for the delay!

    This can be used to exclude something:

    
    add_filter( 'wp-optimize-minify-default-exclusions', function( $default_exclusions ) {
    	// $default_exclusions[] = 'something/else.js';
    	// $default_exclusions[] = 'something/else.css';
    	return $default_exclusions;
    } );
    

    Then these can be used to prevent processing of inlined scripts:

    
    add_filter('wpo_minify_inline_css', '__return_false');
    add_filter('wpo_minify_inline_js', '__return_false');
    Thread Starter alekv

    (@alekv)

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘exclude JavaScript files and inline JavaScript from optimization’ is closed to new replies.