---
title: "Set Custom Code"
method: POST
path: "/wordpress/sites/{site_id}/custom-code"
tags: ["wordpress"]
---

# Set Custom Code

`POST /wordpress/sites/{site_id}/custom-code`

## Request

- Base URL: `https://api.xeorank.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.xeorank.com/wordpress/sites/{site_id}/custom-code`
- Auth: API key in header `X-Agent-Key`

Create/update one site-wide Custom Code snippet — global CSS AND JS.

This is the only site-wide code layer WordPress renders without a theme edit,
and one snippet carries both (`<style>` and `<script>` in the same body). It
is what makes backdrop-filter, keyframe animation, sticky/scroll behaviour and
third-party embeds deliverable without a manual wp-admin step.

`name` is the idempotency key — re-pushing updates in place rather than
stacking duplicate snippets that all inject at once.

CHANGES EVERY PAGE, so it requires confirm=true, like the brand kit.

Read `rendered` in the response, not the status code: the plugin loopback-
fetches the front page and reports whether the code is actually in the HTML.

## Path parameters

- `site_id` string, uuid, required

## Query parameters

- `email` string, nullable

## Request body

- CustomCodeBody
  - `name` string, required
  - `code` string, required
  - `location` string
  - `priority` integer
  - `conditions` string[], nullable
  - `status` string
  - `verify` boolean
  - `confirm` boolean

## Response `200`

Successful Response

- object

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/xeorank/apis/seo-intelligence-engine.md) · [All operations](https://skmtc.dev/xeorank/apis/seo-intelligence-engine/llms.txt) · [OpenAPI document](https://skmtc.dev/xeorank/apis/seo-intelligence-engine/revisions/449a3fd73454?raw)
