WordPress CDN script and style loader

Load any CDN library in WordPress without writing code

Set up a library importer WordPress sites can manage visually: pick GSAP, Alpine.js, Font Awesome or 236 other templates, choose the exact version from the CDN's own release list, and decide whether it loads from the CDN, as a local copy on your own server, or inline in the page — no functions.php required.

  • 240 catalog templates across 14 categories, 33 with starter code.
  • Live version picker for jsDelivr and cdnjs-hosted libraries.
  • Optional local hosting — static file or inline — instead of the CDN.
  • Toggle, duplicate or reorder any library without touching code.
Library ImporterCatalog
GSAP CoreAnimation
Alpine.jsJS Utility
Font Awesome 6Icons
Version
3.12.5 ▾
GSAP Corev3.12.5 · Frontend · Footer
Font Awesome 6Static file · this server · Head
240 templates, 14 categoriesPick a version, or keep a local copy instead of the CDN.
Ready
Quick answer

Library importer WordPress: what does the module actually manage?

This is what a library importer WordPress sites get with TheOneWP: TOWP_Library_Importer stores a list of external script and stylesheet URLs — either typed in manually or picked from a 240-template built-in catalog — and loads each one exactly where it was configured: frontend, backend, both, or the login page, in the head or the footer. For jsDelivr and cdnjs addresses, a live version picker reads the CDN's own release list and rewrites the URL to match. Each library can also be delivered as a locally hosted static file, printed inline into the page, duplicated, reordered by drag and drop, or toggled on and off — all through one admin screen with no theme or plugin file editing involved.

The functions.php problem

Adding one CDN script usually means editing code

Loading a single library from a CDN normally means writing a wp_enqueue_scripts callback, picking a hook priority, and deciding head versus footer by hand — for every library, on every site.

A hardcoded script tag is easy to forget about

A library added directly into a theme file has no on/off switch and no record of why it is there, so it tends to outlive the feature it was added for.

Site builders and marketers cannot add a library themselves

Wanting to try Alpine.js or a new icon set for a landing page usually means asking a developer, even for something as simple as one script tag.

A unified WordPress solution

A visual catalog, not a code edit

The module turns "add this CDN library" into a form: pick from the catalog or paste a URL, choose where it loads, and it is live.

240 templates, ready to use

Popular frameworks, icon sets and utilities are already configured with the right URL, type and default placement.

Precise placement control

Frontend, backend, both, or the login page, each with independent head or footer placement.

Reversible, not permanent

Every library has its own switch — testing a new library never means committing to a code change.

Verified feature set

The complete library importer WordPress feature set

Every capability below is present in the class, its catalog data or the admin view.

Snippets

Starter code for 33 templates

Libraries like AOS, GSAP ScrollTrigger, Chart.js and Swiper include a ready init snippet shown right in the catalog.

Reference onlyCopy-paste ready
Placement

Four locations, two positions

Frontend, backend, both, or the login page; head or footer — set independently for every library.

4 locationsHead / Footer
Versioning

Live version picker

For jsDelivr and cdnjs addresses, a dropdown lists every published version straight from the CDN's own API, and picking one rewrites just the version segment of the URL.

jsDelivr APIcdnjs API
Hosting

Local hosting: static file or inline

Instead of linking the CDN, a library can be downloaded once and served from this site as a linked file, or printed directly into the page as inline code.

Static fileInline
Ordering

Drag-and-drop load order

Reordering updates the stored list directly, so libraries that depend on another loading first — like every GSAP plugin needing GSAP Core — can be sequenced correctly.

towp_li_reorderDependency-aware
Control

Per-library enable toggle, and duplicate

Switch a library off without losing its configuration, or duplicate it — the copy is created switched off, so nothing double-loads by accident.

towp_li_toggletowp_li_duplicate
Detection

Automatic type detection

Leave the type as "auto" and the module infers script or style from the URL's file extension.

.css detectionManual override available
Recommended workflow

Add a library importer WordPress template in four steps

Browse the catalog, place it correctly, and confirm it loaded before building on top of it.

01

Browse or search the catalog

Filter by category or search by name across all 240 templates to find the library you need.

02

Choose location and position

Pick frontend, backend, both, or login page, and head or footer — the catalog pre-fills sensible defaults.

03

Add it and check the starter snippet

If the template includes example code, copy it into your theme or a code snippet to initialize the library.

04

Reorder if load sequence matters

Drag a dependency, like GSAP Core, above the plugins that require it.

Practical use cases

Where a visual library manager saves real time

The module fits any workflow that currently means editing a theme file to add one script tag.

Landing pages with scroll animations

Add GSAP Core plus ScrollTrigger from the catalog and copy the included starter snippet to get moving elements without a build step.

Agencies standardizing a stack across clients

Reuse the same catalog picks — Alpine.js, Swiper, Font Awesome — consistently across every client site without repeating manual enqueue code.

Admin dashboards needing a chart library

Load Chart.js on the backend only, so it never ships to frontend visitors who will never see it.

Operational benefits

A CDN library manager anyone on the team can use

Every design choice in the verified code favors a visual, reversible workflow over a code change.

No theme file editingAdding, moving or removing a library never touches functions.php or a child theme.
Reversible by defaultToggling off or deleting a library is instant, with nothing left behind in a template file.
Curated, correct URLsCatalog templates carry the right CDN path and version already, reducing typo-driven broken includes.
Load order under your controlDrag-and-drop reordering means dependency chains, like the GSAP plugin suite, load correctly.
Performance behaviour

Nothing loads where it wasn't asked to

The verified implementation only prints what each library's own location setting allows.

Location-gated enqueueing

A library set to "Backend" never enqueues on the frontend, and vice versa — each of the four hooks checks the item's own location first.

Disabled means never loaded

An item with its toggle off is skipped entirely in every enqueue method — no dead script tag left in the markup.

No forced cache-busting parameter

Omitting the version string lets the CDN's own caching and versioning behave exactly as that library's provider intended.

Version lists cached for 12 hours

A CDN's published-versions list is fetched once and held in a transient for 12 hours — a failed lookup is remembered for only 5 minutes, so a slow CDN is not retried on every keystroke.

Local copies re-download only when needed

A static or inline library is fetched again when it is newly switched on, when its URL changes, or when the file has gone missing — not on every save.

Security implementation

Every URL validated, every action capability-gated

Loading external code is inherently an admin-trust feature — the code enforces that boundary consistently.

01

manage_options on every action

Adding, editing, deleting, toggling and reordering libraries all require the same administrator-level capability.

02

Real URL validation, not just formatting

wp_http_validate_url() checks that a submitted URL is a genuinely well-formed http:// or https:// address before it is ever saved.

03

Escaped on save and on output

URLs pass through esc_url_raw() when stored and esc_url() again at the point they are printed, on every surface including the login page.

04

Non-guessable library IDs

Each new library gets an ID built from random_bytes(6), not a predictable counter.

05

Local copies stored in a hardened, execution-blocked folder

Downloaded files live in their own uploads/theonewp-libraries folder, which gets a blank index.php and an .htaccess denying any .php request — even though only .css and .js are ever written there.

Verified compatibility

Works with core enqueueing everywhere WordPress allows it

The supplied code integrates through native WordPress hooks, falling back to direct output only where core's own system does not reach. No compatibility claim beyond the verified implementation is assumed.

Frontend/Backend

wp_enqueue_scripts / admin_enqueue_scripts

Standard core enqueue hooks handle every library targeting the frontend, the backend, or both.

wp_enqueue_stylewp_enqueue_script
Login page

login_head / login_footer

Libraries targeting the login page print directly through these hooks, since the standard enqueue system does not apply there the same way.

Direct outputEscaped
Feedback

Shared toast notifications

Save, delete and toggle actions use the same towp-toast.js feedback pattern other TheOneWP admin screens rely on.

towp-toast.jsConsistent UI
Versioning

jsDelivr Data API & cdnjs API

The version picker calls these two CDN APIs directly with wp_remote_get(), and treats a failed or slow response as simply "no versions available" rather than an error.

data.jsdelivr.comapi.cdnjs.com
Solution comparison

TheOneWP versus common alternatives

Compare a real library importer WordPress implementation with typical hardcoded enqueue snippets or a dedicated CDN-loading plugin.

CapabilityTheOneWP Library ImporterOther common solutions
Adding a library Pick from 240 templates or paste any URL, no codeUsually a functions.php snippet per library
Placement control Frontend, backend, both or login page; head or footerDepends entirely on how the snippet was written
Starter code 33 templates ship with a ready init snippetUsually requires finding the library's own docs
Version control Live picker for jsDelivr/cdnjs, reading real published versionsUsually means editing the version number in a URL by hand
Local hosting Optional static file or inline, with automatic CDN fallbackTypically requires a separate asset-optimization plugin
Load order Drag-and-drop reordering built inReordering means editing hook priorities in code
Turning a library off One toggle, instantly reversibleUsually means commenting out or deleting code
Administration One TheOneWP screen, submenu or standaloneMay require a separate plugin and its own settings
Best practices

Add libraries without slowing the site down

A CDN library manager still benefits from a few deliberate choices.

01

Scope location as narrowly as possible

A library only needed in wp-admin should be set to "Backend," not "Both," so frontend visitors never load it.

02

Respect dependency order

Load GSAP Core above any GSAP plugin, and any framework core above plugins that extend it.

03

Turn off what you are not using

A library added to test something and forgotten still loads on every matching page until it is toggled off.

04

Use the starter snippet as a starting point

The included code is meant to be adapted to your actual markup and IDs, not pasted in unchanged.

Common mistakes

Avoid assumptions the code does not support

The module has a defined, verified scope — a few assumptions outside it cause confusion.

Assuming there is a CDN domain whitelist

There is not. Any well-formed http(s) URL is accepted — the actual protection is that only manage_options users can add one at all.

Adding a plugin without its dependency

A GSAP plugin without GSAP Core loaded first, and ordered first, will not work — the module does not add missing dependencies automatically.

Expecting the starter snippet to run itself

Snippets are reference code shown in the catalog; they still need to be copied into your theme or a code-snippet manager to actually execute.

Expecting a version picker on every URL

It only appears for addresses matching jsDelivr's or cdnjs's own URL pattern. A library from another CDN, like the Tailwind Play CDN, has no version to pick — the field simply stays hidden.

Turning static file off and expecting the copy to stay

Switching a library back to loading straight from the CDN deletes its local copy on save — re-enabling it later downloads it again rather than restoring the old file.

Frequently asked questions

Library Importer FAQ

These answers come directly from the verified class, its catalog data and the admin view.

What does Library Importer actually load?

Any external script or stylesheet URL an administrator adds, either picked from a built-in catalog of 240 templates or entered manually. Each one gets a location (frontend, backend, both, or the login page) and a position (head or footer).

How big is the built-in catalog?

240 templates across 14 categories: CSS frameworks, icon sets, animation libraries, the full GSAP plugin suite, JS utilities, UI components, 3D/WebGL, fonts, code editors, file upload, form validation, JS frameworks, layout tools and charting libraries.

Do catalog templates come with example code?

Many do. 33 of the 240 templates include a ready-to-use starter snippet — enough to initialize the library correctly, shown as a reference in the catalog and never injected automatically.

Why do catalog scripts default to loading in the head instead of the footer?

Because a starter snippet often needs the library's global object to exist immediately. get_templates() explicitly forces every script template to the head position so any accompanying inline init code has something to call.

Can Library Importer load a library on the login page?

Yes. Setting a library's location to "Login page" prints its <link> or <script> tag directly in login_head or login_footer, since the login screen does not go through the normal wp_enqueue_scripts flow the same way the rest of the site does.

Is there a whitelist of allowed CDN domains?

No. Any URL that passes wp_http_validate_url() — meaning a well-formed http:// or https:// address — is accepted. The feature itself is gated behind the manage_options capability, so only trusted administrators can add a URL at all.

What happens to the version query parameter WordPress normally adds?

It is intentionally left out. do_enqueue() passes null as the version for every library, so WordPress does not append its own ?ver= string — respecting whatever versioning the CDN URL already has instead.

Can I turn a library off without deleting it?

Yes. Every library has its own enabled toggle, switched through the same AJAX action used for adding and editing — no need to delete and re-add it later.

Which libraries get a version picker?

Only ones hosted on jsDelivr or cdnjs, since those are the two CDNs whose URLs the module knows how to read a package name and version out of. For anything else — a CDN like Tailwind Play, or a custom URL — there is no version to choose, so the field stays hidden.

How does the version picker know what versions exist?

It asks the CDN directly: jsDelivr's own data API for jsDelivr addresses, cdnjs's API for cdnjs ones. The result is cached for 12 hours so switching between libraries in the form does not repeatedly hit the CDN.

What does "static file" actually do?

It downloads the library once and saves it in a dedicated uploads folder on your own site, then links to that local copy instead of the CDN. If the download fails, the library still loads from the original CDN address rather than breaking the page.

What does loading a library "inline" mean?

Instead of a linked file, the library's downloaded code is printed directly into the page through wp_add_inline_style() or wp_add_inline_script() — no separate request for that file at all.

Stop hardcoding script tags.Pick, place and toggle libraries visually.

Use a library importer WordPress teams can share: a 240-template catalog, precise placement, and a switch for every library instead of a code edit.