Migrate a link across your posts

ContentIntermediate~15 minUpdated

Before you start

A connected site with content reads and Replace block enabled, plus Update post for any content that is not in blocks. A link target sits inside a tag, and the find-and-replace tool refuses anything inside a tag or attribute, so the agent reads each post as raw block markup and rewrites the block that holds the link. Posts owned by a page builder are refused. Each edit is recorded in the Changes tab, which can revert it unless the post has been edited again.

You moved a page, and now the old URL is scattered across old posts that still point at the wrong place. Finding all of them by hand means searching, opening each post, and hoping you did not miss one. This does the finding for you and shows its work before it changes anything.

The prompt
I moved a page and need to fix the old link everywhere it still points to the
wrong place. Find every published post whose body still links to
[https://old-url.example/page] and swap it for [https://new-url.example/page].
Do it in two passes. First pass, change nothing: show me every post that has
the old link, with the post title and the sentence around it so I can see the
context. Stick to published posts only, leave drafts and pending alone, and
touch the post body only, nothing else on the post. After I approve the list,
do the replacements a few posts at a time. The old URL sits inside a link tag,
so a plain find-and-replace will be refused: read each post as raw block markup,
replace only the block that holds the link, sending exactly one block and
passing its path and its block name as the expected block name, and keep the
rest of the block as it was. Show me each batch with the old block markup
beside the new one before it saves. If a post has classic content with no
blocks, tell me and wait before using the full post update, and paste the
current body into your reply first. Hand me back the list of every post you
changed and every one you skipped.

Why this is safe to run

The first pass is a search, which writes nothing, so you approve the full list of matches before a single post is edited. The replace itself is narrow: one Replace block call per block that holds the link. Replace block checks the block name at that path before it writes, and it only runs on posts you can already edit. The prompt asks for the old markup with every batch, so a wrong guess about a match is something you put back one post at a time, rather than a migration you have to unpick. A post you want back is a Revert click in the Changes tab, for up to 30 days, unless someone has edited it since.

Already connected? Ask your agent for the “migrate a link across your posts” recipe and it runs the same find-then-approve-then-replace flow on your own content.

How it works

  1. Search published posts for the old URL.
  2. Show every match with the post title and the surrounding sentence.
  3. Wait for your approval on the list.
  4. Read each post as raw block markup and replace only the block that holds the old URL, in small batches.
  5. Return the list of every post it changed.

Questions

Does it touch drafts or pages?
No. It works on published posts only. Pages are left alone.
Can I undo a bad replacement?
Yes. Each change swaps one block, and the agent shows you the old markup with every batch, so it can be put back. The Changes tab in wp-admin can revert any one of them if that post hasn't been edited since.