Guide
By Axel Antas-Bergkvist Published May 27, 2026 Updated May 29, 2026

How to add a CTA to every WordPress post at once

You launched a new product. Or a lead magnet. Or a newsletter. And now every old blog post on your site is a missed opportunity, because none of them mention the new thing. You want a CTA block — a couple of sentences and a link, maybe a button — inserted at a consistent location across the archive: after the second H2, or before the conclusion, or somewhere you’ve picked deliberately.

The WordPress admin can’t help you with this. Block patterns and reusable blocks are great for future posts, but they don’t retroactively land in the 300 posts you already published. You’d have to open every post, find the spot, paste the block, save. By the time you’ve done thirty, you’ve stopped caring.

This is exactly the kind of edit that’s trivial when your posts live as a folder of markdown files. Insert at a marker, do it 300 times, push.

The setup

The whole workflow rests on the same foundation as every bulk job — covered in bulk edit WordPress for SEO.

  1. Connect Specter to your site. Site URL, username, Application Password. Pick a folder. The first sync pulls every post and page down as .md files.

  2. Decide on the CTA. Write it once. Plain markdown. A heading or a blockquote, a sentence or two, a link to the new thing. Something like:

    > **New: The Foo Handbook.** A free 30-page guide to
    > everything I've learned about foo over the last decade.
    > [Get it free →](https://example.com/foo-handbook)

    Or HTML if you want a styled button — WordPress will render it the same way it renders the rest of your post body.

  3. Decide where it goes. “After the second H2” is the most common pick — far enough down that the reader is engaged, not so far that they’ve already bounced. “Before the final H2” is the runner-up. Pick one rule and stick to it; mixing locations is what makes the site look spammy.

Run one pass against the folder

Markdown is just text, and inserting a block at a structural marker is the easy case. Either hand the folder to an AI or use a five-line script — whichever you prefer.

The AI version, with Claude or ChatGPT or Gemini (Claude workflow):

For every .md file in this folder:

- Find the second H2 heading (a line starting with "## ").
- Immediately after that heading's section ends (i.e. just
  before the third H2, or at the end of the file if there
  is no third H2), insert the following block, separated
  from surrounding content by a blank line above and below:

  > **New: The Foo Handbook.** A free 30-page guide to
  > everything I've learned about foo over the last decade.
  > [Get it free →](https://example.com/foo-handbook)

- If a post has fewer than two H2 headings, skip it and
  log the filename.
- If the post already contains the exact CTA block, skip it.

The script version, if you’d rather not involve an AI for something this mechanical, is a short Python or Node script that walks the folder, splits each file at H2 boundaries, and writes the CTA into the right slot. Either works — the folder is the same flat input.

The “skip if already present” rule matters because you will run this twice. The first run misses something, you tweak, you run again. You don’t want every post to end up with two CTAs.

Preview the diff before anything goes live

This is the step that matters most for a job like this. You’re modifying the body of every post on your site. Specter’s dry-run preview shows you the full list of updates, and you can spot-check individual diffs to see exactly where the CTA landed in each post.

Read a dozen at random. Pay attention to:

If the preview looks right, push. Specter batches the updates over the REST API in the background.

Updating or removing the CTA later

This is where the workflow earns its keep beyond the first run. Six months from now the copy is stale or the lead magnet has a new URL. Because the CTA is a block of text you can grep for, updating it is the inverse of the original operation: find the block, replace, preview, push. Removing it is the same job with an empty replacement. Try doing that across 300 posts in the Block Editor.

Where this fits

Same shape as every bulk WordPress edit — sync, edit, preview, push — applied to one use case. The same setup unlocks bulk meta descriptions, fixing broken internal links, and the broader SEO sweep. Once your archive is in a folder, “do X to every post” stops being a wall.

Buy Specter Pro — $99/year Browse all WordPress guides