Hello,
Excluding a particular script from the JS combination depends on whether the script itself is enqueued, external, or inline.
For your convenience, I am providing you with the code you should use in each of these cases:
add_filter( 'sgo_javascript_combine_exclude', 'js_combine_exclude' );
function js_combine_exclude( $exclude_list ) {
$exclude_list[] = 'script-handle';
$exclude_list[] = 'script-handle-2';
return $exclude_list;
}
add_filter( 'sgo_javascript_combine_excluded_external_paths', 'js_combine_exclude_external_script' );
function js_combine_exclude_external_script( $exclude_list ) {
$exclude_list[] = 'script-host.com';
$exclude_list[] = 'script-host-2.com';
return $exclude_list;
}
add_filter( 'sgo_javascript_combine_excluded_inline_content', 'js_combine_exclude_inline_script' );
function js_combine_exclude_inline_script( $exclude_list ) {
$exclude_list[] = 'first few symbols of inline content script';
return $exclude_list;
}
You should make sure to add the respective code into the active theme’s functions.php file.
Best Regards,
Daniela Ivanova