{
  "slug": "strip-wordpress-rest-api-response",
  "title": "Wordpress REST API Response Too Large How to Strip Fields",
  "metaTitle": "Wordpress REST API Response Too - RealComposer",
  "metaDescription": "Wordpress rest api response too large how to strip fields. Map only UI fields from WordPress before Frontend / Web parses JSON.",
  "headline": "Field-level WordPress projection at the edge",
  "category": "slimmer",
  "categoryLabel": "Payload Slimmer",
  "urgency": 8,
  "clientPlatform": "Frontend / Web",
  "upstreamServices": [
    "WordPress"
  ],
  "searchIntentQuery": "wordpress rest api response too large how to strip fields",
  "directAnswerSummary": "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.",
  "problem": {
    "title": "Unmapped WordPress fields waste bandwidth",
    "explanation": "WordPress returns nested CRM, audit, and configuration objects. Frontend / Web parses them on the main thread even when the UI binds three fields.",
    "risks": [
      "Large arrays kept in memory after navigation",
      "Analytics showing poor LCP on API-heavy screens",
      "Developers shipping defensive null checks for unused paths"
    ]
  },
  "solutionSteps": [
    {
      "stepNumber": 1,
      "title": "Store upstream credentials in Secret Vault",
      "description": "Add WP_APPLICATION_PASSWORD to RealComposer Secret Vault. Values decrypt only inside the Cloudflare Worker that calls the upstream."
    },
    {
      "stepNumber": 2,
      "title": "Configure upstream steps and output mapping",
      "description": "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."
    },
    {
      "stepNumber": 3,
      "title": "Call from Frontend / Web",
      "description": "Allowed origins on the token should list every Frontend / Web host that calls this URL.",
      "codeSnippet": "const res = await fetch('https://realcomposer.com/v1/workspace/strip-wordpress-rest-api-response', {\n  headers: { Authorization: 'Bearer rc_live_your_token' }\n});"
    }
  ],
  "pipelineConfig": {
    "name": "Wordpress REST API Response Too Large How to Strip Fields",
    "method": "GET",
    "cacheTtlSeconds": 0,
    "authMode": "client_token",
    "steps": [
      {
        "stepKey": "wordpress",
        "upstreamUrlTemplate": "https://{{secrets.WP_SITE_HOST}}/wp-json/wp/v2/posts?per_page=10",
        "httpMethod": "GET",
        "headersTemplate": {
          "Authorization": "Basic {{secrets.WP_APPLICATION_PASSWORD}}"
        },
        "timeoutMs": 3000
      }
    ],
    "outputMapping": {
      "version": 1,
      "fields": [
        {
          "targetPath": "postId",
          "sourcePath": "0.id",
          "type": "number",
          "sourceStep": "wordpress"
        },
        {
          "targetPath": "title",
          "sourcePath": "0.title.rendered",
          "type": "string",
          "sourceStep": "wordpress"
        }
      ]
    }
  },
  "sampleBloatedInput": {
    "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"
      }
    }
  },
  "sampleSlimmedOutput": {
    "postId": "sample",
    "title": "sample"
  },
  "curlSnippet": "curl -X GET \"https://realcomposer.com/v1/workspace/strip-wordpress-rest-api-response\" \\\n  -H \"Authorization: Bearer rc_live_client_token\"",
  "faqs": [
    {
      "question": "Which WordPress credential belongs in the vault for this pipeline?",
      "answer": "Store WP_APPLICATION_PASSWORD for strip-wordpress-rest-api-response. Frontend / Web never sees decrypted values."
    },
    {
      "question": "Does POST traffic get cached?",
      "answer": "strip-wordpress-rest-api-response POST steps bypass caches.default even if cacheTtlSeconds is set in the dashboard."
    },
    {
      "question": "Can I restrict which domains call this pipeline?",
      "answer": "Allowed origins on the strip-wordpress-rest-api-response client token restrict which domains may call the edge URL."
    }
  ],
  "relatedRecipeSlugs": [
    "fix-cors-error-flutterflow",
    "aggregate-weather-and-geocoding-apis",
    "cache-airtable-avoid-rate-limits"
  ],
  "updatedAt": "2026-11-20",
  "links": {
    "page": "https://realcomposer.com/recipes/strip-wordpress-rest-api-response",
    "markdown": "https://realcomposer.com/recipes/strip-wordpress-rest-api-response.md",
    "json": "https://realcomposer.com/recipes/strip-wordpress-rest-api-response.json",
    "install": "https://realcomposer.com/dashboard/pipelines/new?recipe=strip-wordpress-rest-api-response&via=agent"
  }
}