Wopisanje
WP Components lets one WordPress site act as a Host that publishes a Library of named pieces of content — a logo, a tagline, a social-links JSON blob, a privacy notice — and any number of other sites act as Receivers that subscribe to that Host and consume those components instantly.
Every component has a stable slug, a type (json, text, or file), a per-component cache TTL, and an auto-incrementing version number that becomes its HTTP ETag. Subscribers fetch the latest version on demand and revalidate cheaply with 304 Not Modified for unchanged content.
A single site can also act as both Host and Receiver — publish your own Library while subscribing to one or more remote Hosts.
Use cases
- Keep brand assets (logo, favicon, tagline, contact info) in sync across a fleet of WordPress sites without copy-paste.
- Centralise structured data (footer links, locations, pricing tables) so updating once propagates everywhere.
- Serve component content from a dedicated CDN subdomain via a thin reverse-proxy layer.
- Pull versioned content into a headless frontend (Next.js, Astro, Vercel) with stable cache semantics.
Key features
- Three component types — JSON, plain text, and file (proxies URLs through the REST endpoint).
- Two independent capabilities — publish your Library and/or subscribe to a remote Host. Toggle each side on or off in Settings.
- HTTP cache headers — every
/rawresponse sendsETag,Last-Modified, andCache-Control: public, max-age=<TTL>, must-revalidate. Conditional requests get304 Not Modified. - Per-IP rate limiting — 120 requests per 60 seconds on the host endpoints.
- CORS control — open, allowlist, or denylist by domain (with
*.example.comwildcard support). - Optional authentication — require Application Passwords on either side independently.
- Source connection tester — verify a Host URL from the Settings page before saving.
- Native admin UI — built on WordPress admin patterns, fully translatable.
REST endpoints (Host mode)
GET /wp-json/wp-components/v1/components— list all published componentsGET /wp-json/wp-components/v1/components/{slug}— fetch one as JSON metadataGET /wp-json/wp-components/v1/components/{slug}/raw— fetch with type-appropriateContent-Type(text/plain, application/json, or proxied file bytes)
Instalacija
- Install the plugin from Plugins Add New and search for Artificial Poets Reusable Components CDN, or upload the
.zipvia Plugins Add New Upload Plugin. - Activate Artificial Poets Reusable Components CDN under Plugins Installed Plugins.
- Open Components in the admin menu; the onboarding screen asks how you want this site to participate.
- Publish only to expose a Library via REST. Subscribe only to pull from another Host. Both to do both.
- If subscribing, enter the Host URL under Components Settings Source Subscription and click Test Connection.
HSP
-
Does this work for headless WordPress / Next.js / Astro frontends?
-
Yes. The Host’s
/wp-json/wp-components/v1/components/{slug}/rawendpoint returns the content with the rightContent-Typeheader and properCache-Control/ETag, so a frontend canfetch()it directly. For images, an<img src="">works without any client-side glue. -
Can one site be both Host and Receiver?
-
Yes. Set Publish Library and Subscribe to Source both ON in Settings. You’ll see your own Library and the remote Source in separate tabs in the admin menu.
-
How is the cache invalidated when I update a component?
-
Every save bumps the component’s version, which is also the
ETag. The next request from a subscriber gets a fresh response; subsequent requests withIf-None-Matchget a fast304 Not Modified. -
Does the plugin require an external service?
-
No. All data stays on your own WordPress sites. There are no calls to third-party servers, no telemetry, no SaaS dependencies.
-
Can I require authentication between Host and Receiver?
-
Yes. On the Host: Components Settings Library Publishing Access can require an Application Password. On the Receiver: Settings Source Subscription Authentication lets you send Application Password credentials when fetching.
-
What does it cost?
-
Nothing. The plugin is GPL-2.0-or-later and free to use commercially.
Pohódnoćenja
Za tutón tykač pohódnoćenja njejsu.
Sobuskutkowarjo a wuwiwarjo
„Artificial Poets Reusable Components CDN“ je softwara wotewrjeneho žórła. Slědowacy ludźo su k tutomu tykačej přinošowali.
SobuskutkowarjoPřełožće „Artificial Poets Reusable Components CDN“ do swojeje rěče.
Na wuwiću zajimowany?
Přehladajće kod, hladajće do SVN-repozitorija abo abonujće wuwiwanski protokol přez RSS.
Protokol změnow
0.1.0
- First public release.
- Host / Receiver / Both modes via two independent capability toggles.
- JSON, text, and file component types.
- Per-component cache TTL with ETag-based revalidation and
304 Not Modifiedsupport. - Per-IP fixed-window rate limiting on host endpoints.
- CORS open / allowlist / denylist with subdomain wildcards.
- Independent Application Password auth on the publish and subscribe sides.
- Source connection test in Settings.