Exclude files from Load CSS Asynchronously
In some cases the option Load CSS Asynchronously may conflict with a specific file.
If this option causes any problems, you may need to exclude a file from the process. You can do that by downloading, installing, and editing the following small helper plugin.
📝 Manual code edit required before use!
You must edit the line beginning with $excluded_files[]
to reflect the path of the file you want to exclude.
📥 Download (.zip): WP Rocket | Exclude Files from Async CSS
Developers: You can find the code for this plugin on GitHub.
Tips to make this work #
Exclude from CSS minify
If you are using CSS minify you must exclude the same files from that option.
Excluding multiple files #
Wildcards don't work here. Each exclusion must be added with a new line. For example:
$excluded_files[] = '/wp-content/plugins/plugin-name/filename1.css'; $excluded_files[] = '/wp-content/plugins/plugin-name/filename2.css'; $excluded_files[] = '/wp-content/plugins/plugin-name/filename3.css';
For wildcard exclusions, please check: Exclude all CSS files in a folder / directory from Load CSS Asynchronously
Remove query string
Remove any query string following the .css
extension. For example, to exclude:
https://example.com/wp-content/themes/neutro/style.css?ver=1.2.5
use:
/wp-content/themes/neutro/style.css
Excluding externally hosted files
Use the filepath following the domain name to exclude files not hosted on your own domain. For example, to exclude:
https://cloud.typography.com/6907774/6146531/css/fonts.css
Use:
/6907774/6146531/css/fonts.css