Wordpress REST API Response Too Large How to Strip Fields
Field-level WordPress projection at the edge
WordPress responses include fields Frontend / Web never renders. Map id, status, and UI columns at the edge after calling https://{{secrets.WP_SITE_HOST}}/wp-json/wp/v2/posts?per_page=10.
Unmapped WordPress fields waste bandwidth
WordPress returns nested CRM, audit, and configuration objects. Frontend / Web parses them on the main thread even when the UI binds three fields.
- Large arrays kept in memory after navigation
- Analytics showing poor LCP on API-heavy screens
- Developers shipping defensive null checks for unused paths
How RealComposer Solves This at the Edge
Store upstream credentials in Secret Vault
Add WP_APPLICATION_PASSWORD to RealComposer Secret Vault. Values decrypt only inside the Cloudflare Worker that calls the upstream.
Configure upstream steps and output mapping
Configure headersTemplate to inject vault secrets, target https://{{secrets.WP_SITE_HOST}}/wp-json/wp/v2/posts?per_page=10, and Map only the UI fields in output mapping so clients never download audit or nested blobs.
Call from Frontend / Web
Allowed origins on the token should list every Frontend / Web host that calls this URL.
const res = await fetch('https://realcomposer.com/v1/workspace/strip-wordpress-rest-api-response', {
headers: { Authorization: 'Bearer rc_live_your_token' }
});
{
"requestId": "req_strip-wo",
"upstreamLatencyMs": 142,
"audit": {
"region": "edge",
"trace": "strip-wordpress-rest-api-response"
},
"payload": {
"id": "sample_id",
"status": "active",
"nested": {
"tags": [
"demo"
],
"internal": true
},
"unused_blob": {
"foo": "bar",
"bar": "baz"
}
}
}
{
"postId": "sample",
"title": "sample"
}
Recipe Specs
- HTTP method
- GET
- Upstream calls
- 1
- Edge cache TTL
- No caching
- Client auth
- Restricted client token
- Mapped output fields
- 2
- Payload
- 252 B to 36 B (-86%)
curl -X GET "https://realcomposer.com/v1/workspace/strip-wordpress-rest-api-response" \ -H "Authorization: Bearer rc_live_client_token"
Developer Questions & Troubleshooting
Which WordPress credential belongs in the vault for this pipeline?
Store WP_APPLICATION_PASSWORD for strip-wordpress-rest-api-response. Frontend / Web never sees decrypted values.
Does POST traffic get cached?
strip-wordpress-rest-api-response POST steps bypass caches.default even if cacheTtlSeconds is set in the dashboard.
Can I restrict which domains call this pipeline?
Allowed origins on the strip-wordpress-rest-api-response client token restrict which domains may call the edge URL.
Sources & Definitions Used in This Answer
Deploy this Frontend / Web + WordPress Recipe
Clone this pre-configured pipeline into your RealComposer workspace in one click. We pre-populate upstream URLs, headers, and mapping rules.