wp-init

A command that prepares a WordPress site port by detecting the source builder, available pages, target stack, and styling setup. It then writes the detected project settings to a configuration file.

In plain words
What is it for?
Use it to inspect a site, choose pages and styling mode, confirm the development URL, and create the port configuration.
Why use it?
It removes much of the initial guesswork before rebuilding a named site in code. It also identifies the decisions that still need the user's input, such as which pages to port.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/abdulkader-safi/wp-to-code/wp-init
Clone the repo
git clone --depth 1 https://github.com/Abdulkader-Safi/wp-to-code
Per session 26 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 759 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00026 $0.00759
Opus 5 $0.00013 $0.00380
Sonnet 5 $0.00005 $0.00152
Haiku 4.5 $0.00003 $0.00076

Measured 2d ago against content hash a59b7c82f9a1, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

wp-init scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/wp-to-code/commands/wp-init.md · 66 lines

How it starts

The opening of the file, as written. The whole thing — 66 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Set up a port of the site the user named: $ARGUMENTS.

1. Detect

node "${CLAUDE_PLUGIN_ROOT}/scripts/detect.mjs" --url <url>

This reports the page builder, whether the REST API and a sitemap are available, the pages it found, and which stack the current directory already is. The JSON goes to stdout, the readable summary to stderr.

2. Ask only what detection could not answer

Detection covers the builder, the page list, the stack and the Tailwind version. What is left:

  • Which pages to port. The sitemap usually returns everything including blog posts. Show the list and let the user pick. Ten pages is a normal scope; forty is not.
  • Styling mode. tailwind rebuilds the styles from measured values, which is slower and gives clean output. passthrough keeps the original CSS, which is fast but, on Elementor, means keeping the original wrapper markup too, because the CSS is scoped per post ID. Say that trade-off plainly rather than listing the modes.
  • Dev server URL, if the guess is wrong.

Do not ask about the builder, the breakpoints or the token names. Those come from measurement later.

3. Write the config

{
  "source": {
    "url": "https://example.com",
    "builder": "elementor",
    "restApi": true,
    "sitemap": "/wp-sitemap.xml",
    "headers": {}
  },
  "pages": [
    { "slug": "home", "sourcePath": "/", "targetRoute": "/",
      "originalRoot": null, "portRoot": "main" }
  ],
  "target": { "stack": "next-app", "componentDir": "components/sections", "routeDir": "app" },
  "css": { "mode": "tailwind", "tailwindVersion": 4, "tokenFile": "app/globals.css" },
  "viewports": [1440, 1280, 1024, 768, 390],
  "mirror": { "dir": ".wp-to-code/mirror", "port": 4321, "images": "remote" },
  "port": { "devUrl": "http://localhost:3000" }
}

originalRoot is the selector whose direct children are the page's top-level sections. Leave it null now: you cannot know it until the page is mirrored. /wp-mirror is the next step, and after it you find the root by grepping the mirrored HTML for the builder's page-root class, then checking which candidate has the most sections with /wp-measure --mode sections.

Read the full file on GitHub · 66 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 66 lines · 26 tokens per session scan A a59b7c82f9a1

Subscribe to this mod's changes

wp-init is a command published in the GitHub repository Abdulkader-Safi/wp-to-code (2 stars, last pushed 13d ago), licensed MIT. It adds 26 tokens to every session and 759 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.