Find and replace across your posts and pages

MaintenanceBeginner~10 min

Before you start

A connected site with content reads on and the content write abilities enabled. Know the exact old phrase and the exact new one. This edits post and page content only.

A brand name changes, a product gets renamed, a URL you reference everywhere finally moves, and now an old phrase is scattered through years of posts and pages. Opening each one to fix it is the definition of tedious, and the search-and-replace plugins that reach into the whole database are the ones people are most nervous about running, because a bad match there can corrupt serialized data you never see.

This stays narrow on purpose. It edits the readable content of posts and pages, shows you every hit first, and does the replacement literally.

The prompt
I need to change [old phrase] to [new phrase] everywhere it appears in my
posts and pages. Start read-only: search the content for [old phrase] and
show me every post and page it turns up in, with the surrounding line so I
can see the context. Change nothing yet.
Wait for my go-ahead. Only after I approve, run a literal find-and-replace
of [old phrase] with [new phrase] in each post and page body, in small
batches, showing me each batch before it saves. Edit only the body text,
leave the status alone so nothing republishes, and keep it reversible
through each post's revisions. When you finish, list every post and page you
changed.

Why this is safe to run, and exactly how far it reaches

The first pass is a read. The search shows you every post and page the old phrase lives in, with the surrounding line, so you approve the real list before anything saves. The replacement is literal, one exact string for another, so it will not fuzzy-match its way into text you meant to keep, and each edit saves as a revision without touching the status, so nothing republishes and any change rolls back from the editor.

Be clear on the scope, because this is where the honest limit sits: this edits the content body of posts and pages only. It does not reach into the database directly, site options, widgets, navigation menus, theme or plugin settings, or values stored as serialized data. If your phrase lives in a widget, a theme option, or a page-builder’s stored layout, this recipe will not find it or change it, and that is by design, since those are exactly the places a blunt database replace does its damage. The content write ability stays off until you enable it, every call is checked against the bound user’s capability, and each edit is written to the Activity Log with the post or page it changed.

Already connected? Skip the paste. Ask your agent for the “find and replace across your posts and pages” recipe, give it the old and new phrase, and it runs the same search-approve-replace flow on your own install.

How it works

  1. Search your content for the old phrase and show you every post and page it appears in.
  2. Show the surrounding line for context and wait for your approval.
  3. Run a literal find-and-replace of the old phrase for the new one, body only.
  4. Work in small batches, showing you each batch before it saves.
  5. Return the list of every post and page it changed.

Questions

Does this change my whole database, or just the content?
Just the content. It edits the body of posts and pages and nothing else. It does not touch the database directly, site options, widgets, menus, theme or plugin settings, or anything stored as serialized data, so a phrase living in a widget or a page-builder layout is not in scope.
Can I undo a replacement?
Yes. Each edit is a literal replace on the body that saves as a normal revision, and it never changes the status, so you can roll any post or page back from the editor and nothing republishes.