Articles on: Developers

Host third party CSS and JS locally

The flying_press_selfhost_external_domains filter allows you to customize the list of external domains whose CSS and JS assets are self-hosted by FlyingPress.

By default, these domains are self-hosted:
cdn.jsdelivr.net
cdnjs.cloudflare.com
unpkg.com
code.jquery.com
ajax.googleapis.com
use.fontawesome.com
bootstrapcdn.com
cdn.rawgit.com

You can add or remove domains by using this filter in your theme’s functions.php or using a Code Snippets plugin:

add_filter('flying_press_selfhost_external_domains', function ($domains) {
    $domains[] = 'example-cdn.com';
    $domains[] = 'another-cdn.com';
    return $domains;
});

Updated on: 05/10/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!