registered[ $handle ] ) ) { $src = $wp_scripts->registered[ $handle ]->src; // Check for plugin folder name or text domain in the script source if ( strpos( $src, 'bt-bb-ab' ) !== false || strpos( $src, 'ABSPLITTEST' ) !== false ) { return false; } } return $do_concat; } add_filter( 'js_do_concat', 'abst_page_optimize_exclude', 10, 2 ); function abst_nitropack_inline_script_attributes( $attr, $js ) { if ( ! is_array( $attr ) ) { return $attr; } if ( empty( $attr['id'] ) || ! is_string( $attr['id'] ) ) { return $attr; } $id = $attr['id']; foreach ( abst_exclude_js() as $needle ) { if ( $needle !== '' && strpos( $id, $needle ) !== false ) { $attr['nitro-exclude'] = true; $attr['data-cfasync'] = 'false'; $attr['data-no-optimize'] = '1'; $attr['data-no-defer'] = '1'; $attr['data-no-minify'] = '1'; $attr['nowprocket'] = true; // Dodge keyword-based delayers that only match untyped / // text/javascript scripts (Flying Scripts has no exclusion filter). $attr['type'] = 'application/javascript'; break; } } return $attr; } add_filter( 'wp_inline_script_attributes', 'abst_nitropack_inline_script_attributes', 10, 2 ); // W3 Total Cache minify ignores the exclusion attributes the other optimisers honour. function abst_w3tc_skip_js_minify( $do_minify, $script_tag, $file ) { foreach ( abst_exclude_js() as $needle ) { if ( $needle !== '' && strpos( $script_tag, $needle ) !== false ) { return false; } } return $do_minify; } add_filter( 'w3tc_minify_js_do_tag_minification', 'abst_w3tc_skip_js_minify', 10, 3 );