Sign inBlogAboutSupportContact
Content

Bulk find-and-replace across every post without phpMyAdmin

Search content, titles, and excerpts across your entire site in one command. Preview matches first with a dry run, then commit. No database client, no plugin, no manual rows.

5 min read May 2026 replace

The old domain name is still in 800 posts

You rebranded last month. The domain changed, the plugin name changed, maybe even the company name changed. The content editor updated the homepage and the about page. The other 800 posts still say the old thing. Every one of them.

It isn't just branding. A partner's URL rotated, a product was discontinued, a typo slipped through a batch import and now lives in 300 WooCommerce product descriptions. Fixing them one by one is not a plan. It is a punishment.

What most people do

Run a raw SQL UPDATE in phpMyAdmin Works once. Then you remember serialized data, encoding differences, and the fact that there is no preview step. One typo in the WHERE clause and you have updated the wrong column on every row.
Install a search-replace plugin Better-Search-Replace and WP CLI's search-replace both touch the database directly and can corrupt serialized values. They also operate outside WordPress, so revisions are not created and there is no per-post rollback.
Edit posts manually in the block editor Fine for five posts. Painful for fifty. Impossible for five hundred. And you will miss at least one, because ctrl+F does not search the whole site.

A better way: one command, dry run first

TrueCommander's replace command runs through wp_update_post, so WordPress handles serialization, fires the right hooks, and creates a revision for every changed post. You get a per-post rollback trail without any extra effort.

TrueCommander
Dry run: 47 matches found
No posts were changed
47 posts would be updatedpreview only
Field content · case-sensitive
Re-run without -dry-run=true to commitrevisions kept

Always run with -dry-run=true first. The live run updates posts immediately via wp_update_post and creates revisions for rollback, but there is no cross-post undo. Preview the match count, confirm the right posts are in scope, then drop -dry-run=true to commit.

How it works

1
Preview with -dry-run=true The command scans every post in scope and reports how many would change. Nothing is written. Run this until the match count looks right.
2
Commit the live run Remove -dry-run=true and run again. Each matched post is updated through wp_update_post, which fires hooks and creates a revision automatically.
3
Roll back individual posts if needed Because revisions are created, you can restore any single post from the WordPress revision screen. There is no all-at-once undo, so the dry run in step 1 matters.
ParameterDetails
-fromText or regex pattern to find. Required.
-toReplacement text. Leave empty to delete matched text.
-dry-runDefault false. Set to true to preview without writing any changes.
-case_sensitiveDefault true. Set to false for case-insensitive matching.
-whole_wordDefault false. Adds \b word boundaries so "cat" does not match "category". Mutually exclusive with -regex.
-regexDefault false. Treats -from as a PCRE pattern (no delimiters needed). Mutually exclusive with -whole_word.
-fieldsCSV of fields to search: content, title, excerpt. Default content.
-post_typeCSV of post type slugs. Default: all public types except attachments.
-post_statusDefault publish,draft,private,pending,future.
-post_idsComma-separated post IDs. Overrides -post_type, -post_status, and -limit. Useful when chaining from filter posts.
-limitMax posts per run. Default 500, max 5000.
Can be used in

Real example

You migrated a client's site from staging.example.com to example.com three weeks ago. Everything looked fine in the browser, but a spot-check of product descriptions today revealed the old staging URL in 63 posts. It is in the content field only, never in titles.

You run tp replace -from="staging.example.com" -to="example.com" -dry-run=true -post_type=product. The dry run comes back: 63 matches across 58 products. Good. You drop -dry-run=true and run again. Fifty-eight products updated, 58 revisions created. You open three at random in the editor, confirm the URL is gone, and you are done in under two minutes.

One product has a custom field you forgot about. No problem: the revision for that post is sitting in the WordPress revision screen, one click to restore.

Goes further with TrueCommander

Ready?

Replace that text across every post.

One of 91 commands. All included with every license.

Cookies. The short version.

Essential cookies keep the cart and theme working. Analytics only fire if you say yes. Read our policy.