Exclude files from JavaScript defer and delay
FlyingPress optimizes JavaScript loading by deferring and delaying scripts, but certain files may need to be excluded. Developers can programmatically exclude files using the following filters:
Use the flying_press_exclude_from_defer:js filter to exclude specific files from defer:
Use the flying_press_exclude_from_delay:js filter to exclude specific files from delay:
Exclude from Defer
Use the flying_press_exclude_from_defer:js filter to exclude specific files from defer:
add_filter('flying_press_exclude_from_defer:js', function ($exclude_keywords) {
$exclude_keywords[] = 'example-script'; // Replace with your keyword or file identifier
return $exclude_keywords;
});
Exclude from Delay
Use the flying_press_exclude_from_delay:js filter to exclude specific files from delay:
add_filter('flying_press_exclude_from_delay:js', function ($exclude_keywords) {
$exclude_keywords[] = 'example-script'; // Replace with your keyword or file identifier
return $exclude_keywords;
});
Updated on: 12/12/2024
Thank you!