FlyingPress can automatically self-host CSS and JavaScript files from trusted external domains. This improves performance by reducing DNS lookups and avoiding third-party blocking or delays.
You can customize the list of domains using the flying_press_selfhost_external_domains filter.
Default domains automatically self-hosted
FlyingPress self-hosts assets from the following domains by default:
cdn.jsdelivr.netcdnjs.cloudflare.comunpkg.comcode.jquery.comajax.googleapis.comuse.fontawesome.combootstrapcdn.comcdn.rawgit.com
Where to add this code
Add the filter in:
Your theme’s
functions.phpfileA custom plugin
A plugin like Code Snippets
Example: Add more domains to self-host
add_filter('flying_press_selfhost_external_domains', function ($domains) {
$domains[] = 'example-cdn.com';
$domains[] = 'another-cdn.com';
return $domains;
});You can also remove domains by modifying or filtering the $domains array accordingly.
Notes
The domain must be present in the HTML output at page load
Resources injected via JavaScript after page load won’t be detected or self-hosted
Only CSS and JS files are considered—no images, fonts, or other resources
