
內容簡介
總結:Content Bridge for Commerce 提供了一個輕量的 REST API 端點,讓外部商務平台(如 Shopify)可以擷取 WordPress 編輯內容。這個外掛不同步資料庫或複製內容,僅透過清潔、結構良好的 JSON API,將您的 WordPress 文章暴露出來,讓外部進行消費。
問題與答案:
1. Content Bridge for Commerce 的外掛特點有哪些?
- 透過 REST API 擷取最新的 WordPress 文章
- 可以透過類別或標籤(使用 slug)來篩選文章
- 返回特色圖片、摘要和發表日期
- 可以選擇將 Jetpack(i0.wp.com)CDN 圖片網址轉換回原始網址
- 可配置預設文章數量和限制
- 內建短期快取(5 分鐘),減少資料庫負載
- 不需要資料重複或遷移
2. 如何設定 REST API 的端點?
基本端點為:/wp-json/content-bridge/v1/posts
- 最新文章:/wp-json/content-bridge/v1/posts?per_page=4
- 依標籤篩選文章:/wp-json/content-bridge/v1/posts?tax=post_tag&term=guidi&per_page=4
- 依類別篩選文章:/wp-json/content-bridge/v1/posts?tax=category&term=news&per_page=4
如果未指定分類法,API 將返回所有已發佈文章的最新文章。
3. Content Bridge for Commerce 如何進行身分驗證?
這個外掛使用簡單的 API 金鑰機制來保護其 REST API。請求必須在以下 HTTP 標頭中包含有效的 API 金鑰:
X-Content-Bridge-Key: YOUR_API_KEY
如果 API 金鑰遺失或無效,端點將返回 401 未經授權的響應。可以在外掛設定畫面中配置 API 金鑰,並可在外掛設定畫面中手動設置或生成 API 金鑰。
外掛標籤
開發者團隊
原文外掛簡介
Content Bridge for Commerce provides a lightweight REST API endpoint that allows external commerce platforms such as Shopify to fetch WordPress editorial content.
This plugin does not sync databases or duplicate content. It simply exposes your WordPress posts through a clean, structured JSON API designed for external consumption.
Key Features
Fetch latest WordPress posts via REST API
Filter posts by category or tag (using slug)
Return featured image, excerpt, and publish date
Optional conversion of Jetpack (i0.wp.com) CDN image URLs back to original URLs
Configurable default post count and limits
Built-in transient cache (5 minutes) to reduce database load
No data duplication or migration required
REST API Endpoint
Base endpoint:
/wp-json/content-bridge/v1/posts
Examples:
Latest posts:
/wp-json/content-bridge/v1/posts?per_page=4
Posts filtered by tag:
/wp-json/content-bridge/v1/posts?tax=post_tag&term=guidi&per_page=4
Posts filtered by category:
/wp-json/content-bridge/v1/posts?tax=category&term=news&per_page=4
If no taxonomy is specified, the API returns the latest posts from all published posts.
Authentication
This plugin protects its REST API using a simple API key mechanism.
Requests must include a valid API key via the following HTTP header:
X-Content-Bridge-Key: YOUR_API_KEY
If the API key is missing or invalid, the endpoint will return a 401 Unauthorized response.
The API key can be configured in the plugin settings screen.
The API key can be manually set or generated from the plugin settings screen.
Settings
Settings → Content Bridge for Commerce
Default number of posts
Maximum allowed posts per request
Image size (thumbnail / medium / large / full)
Excerpt length (word count)
Enable or disable Jetpack CDN URL unwrapping
Privacy
Content Bridge for Commerce does not collect, store, or transmit any personal data.
The plugin only exposes publicly available WordPress post data (such as title, excerpt, featured image, and permalink) via a REST API endpoint.
No data is sent to external servers by this plugin.
