Back to Blog

How to Create a WordPress Website With OpenAI Codex in 2026

Two ways to build WordPress sites with Codex, and a tested one-command setup that lets Codex create complete hosted sites and edit them safely.

Bennett Black

Bennett Black

October 5, 2026|9 min read

How to create a WordPress website with OpenAI Codex: terminal connected to a finished WordPress site

Quick Answer

The fastest way to create a WordPress website with OpenAI Codex is to connect Codex to the 1ClickWebsite MCP server and ask for the site in plain language. Codex has 1ClickWebsite build a complete, hosted WordPress site, follows the build, and returns the link. It can then edit the site's content, SEO, colors, and images, and undo any change.

export ONECLICKWEBSITE_API_KEY="your-1clickwebsite-api-key"
codex mcp add 1clickwebsite --url https://www.1clickwebsite.ai/api/mcp \
  --bearer-token-env-var ONECLICKWEBSITE_API_KEY

Then run codex and ask: "Build a website for Harbor Plumbing, a plumber in San Diego, CA." Create the API key on your 1ClickWebsite API Keys page. Each new site uses one site credit.

Two Ways to Build WordPress Sites With Codex

ApproachWhat Codex doesBest for
Codex writes the codeBuilds a custom block theme or plugin in a local WordPress project that you then deployDevelopers who want full control of the code
Codex uses the 1ClickWebsite MCP serverHas a complete hosted site built, then edits its content, pages, SEO, and designGetting finished business websites quickly, including many at once

Most Codex guides cover the first path: set up a local WordPress environment, ask Codex to scaffold a theme, test it, and deploy. That's the right choice for a custom product. For local-business websites, it means rebuilding the same pages, forms, and service sections every time. With the MCP server, Codex works at the website level instead of the file level. If you want the code-first approach, see how to build a local business website with Claude Code or Codex.

What You Need

  • Codex (the Codex CLI or another Codex surface that reads ~/.codex/config.toml).
  • A 1ClickWebsite account with site credits, and an API key from the API Keys page.
  • The business details for each site: name, trade, city, phone, and services.

Step 1: Store Your API Key

Keep the key out of your config file by putting it in an environment variable. Add this to your shell profile (for example ~/.zshrc), then open a new terminal:

export ONECLICKWEBSITE_API_KEY="your-1clickwebsite-api-key"

Treat the key like a password: anyone with it can create and edit sites on your account. You can revoke it on the API Keys page at any time.

Step 2: Add the MCP Server to Codex

codex mcp add 1clickwebsite --url https://www.1clickwebsite.ai/api/mcp \
  --bearer-token-env-var ONECLICKWEBSITE_API_KEY

This adds the server to ~/.codex/config.toml:

[mcp_servers.1clickwebsite]
url = "https://www.1clickwebsite.ai/api/mcp"
bearer_token_env_var = "ONECLICKWEBSITE_API_KEY"

Check it with codex mcp list. You should see 1clickwebsite as enabled, with Bearer token auth.

Step 3: Ask Codex to Build a Site

Start Codex and describe the business:

Using the 1clickwebsite MCP server, build a website for Harbor Plumbing,
a plumber in San Diego, CA. Phone (619) 555-0134. Services: drain cleaning,
water heater repair, leak detection and repiping. Send me the link when ready.

Codex checks your credits, picks a template, and starts the build. A site takes a few minutes; ask Codex to check the build status and it returns the site link once it's live.

Step 4: Approve Changes

Codex treats 1ClickWebsite's tools differently depending on what they do. Tools that only read, like checking credits or finding text on a site, run without stopping. Tools that change something, like creating a site or editing a page, ask for your approval first. Read the request and approve it if it matches what you asked for.

You can change this per server in ~/.codex/config.toml:

[mcp_servers.1clickwebsite]
url = "https://www.1clickwebsite.ai/api/mcp"
bearer_token_env_var = "ONECLICKWEBSITE_API_KEY"
default_tools_approval_mode = "writes"

The supported values are prompt, writes (ask only for tools that change things), auto, and approve. If you run Codex non-interactively with codex exec and an approval policy of never, change tools are blocked unless you set approve. In our test, Codex reported the blocked edit clearly and changed nothing. Only use approve for runs you trust, because it lets Codex create sites and make edits without asking.

Step 5: Edit, Verify, and Undo

On Ridgeway Plumbing, change the small text above the homepage headline to
"Trusted San Diego Plumbers", confirm it's live, then undo it and confirm
the original text is back.

Codex reads the site's editing guide, finds the right field, makes the change, checks the live site, then rolls the change back and checks again. Every edit is saved as an undoable step, so you can try something and keep only what works.

Use Cases for Codex

  • Batch builds. Give Codex a CSV of businesses and have it create a site for each, then report every link.
  • Bulk edits. Update a phone number, hours, or a seasonal offer across several sites in one session.
  • Lead Gen. Create one-page demo sites for a prospect list and export the links to CSV for outreach.
  • Audits. Ask Codex to read each site and list missing service pages, weak headlines, or SEO titles that need work.

Common Problems

Codex says the server isn't authorized

Make sure ONECLICKWEBSITE_API_KEY is set in the terminal where you run Codex (echo $ONECLICKWEBSITE_API_KEY), and that the key hasn't been revoked.

Edits are blocked

You're probably running codex exec with an approval policy of never. Run Codex interactively and approve the change, or set default_tools_approval_mode as shown in Step 4.

Codex can't find a site

Ask it to list your sites first. Codex can only see sites in the 1ClickWebsite account the API key belongs to.

Frequently Asked Questions

Can Codex build a WordPress website?

Yes. Codex can write a theme from scratch, or, with the 1ClickWebsite MCP server, have a complete hosted WordPress website built from a short brief and then edit it.

Do I need a local WordPress install?

Not with the MCP server. 1ClickWebsite hosts the WordPress site, so Codex never needs WordPress on your machine.

Can I use OAuth instead of an API key?

Apps that sign in with OAuth, like ChatGPT and Claude, connect without a key. For Codex, the API key with bearer_token_env_var is the documented setup.

What can't Codex do through 1ClickWebsite?

It can't buy credits, change your plan, or access websites outside your account.

Sources and Review Notes

We tested this setup with Codex CLI 0.159 on October 5, 2026: adding the server, listing it, checking credits and sites, the blocked edit under never, and an edit, live check, and undo with approve. Site creation uses the same server we tested end to end in ChatGPT and Claude.