Search & Replace PRO

PRO This is a WP Coder Pro feature — the free WP Coder doesn’t include it. Compare WP Coder and WP Coder Pro Pricing

WP Coder Pro → Search & Replace finds text across all your snippets and replaces it in the ones you choose — for example a renamed CSS class, a new API URL, or a changed phone number.

It always shows the matches first; nothing changes until you confirm.


The form#

Field Purpose
Search for The text to find. Required.
Replace with The new text. Leave it empty to delete the matched text.
Search in Which parts of a snippet to search: HTML, CSS, JS, PHP (all four ticked by default) and Title.
Case sensitive On by default. Turn it off to match Button and button alike.
Regular expression Treat Search for as a PCRE pattern — see below.
Skip snippets that are off Search only snippets that are switched on.
Limit to tag Search only snippets with this tag (All Codes).

How it works#

  1. Fill in the form and click Preview matches (or press Ctrl/Cmd + Enter).
  2. The result shows “N match(es) in M snippet(s)” and a table: each snippet with its ID, its title and the matches, so you can see what will change. No matches found. means nothing to replace.
  3. Untick any snippet you want to leave alone.
  4. Click Replace in selected snippets and confirm.
  5. A notice reports “Done: N replacements in M snippets.” and lists the changed snippets, each linked to its revisions. The form keeps your search, so a new preview can check the result.

Changing the search after a preview disables Replace until you preview again. An empty Replace with is marked as deleting, with a red button.

After a replacement each changed snippet’s CSS, JS and PHP files are regenerated, and any combined files that include it are rebuilt — the change is live straight away.


Undoing a replacement#

Before a snippet is changed, its current state is saved as a revision — always, even if Revision History is turned off. To undo, open the snippet and restore the previous revision from the Revisions panel (Revisions).

There is no single “undo all”: each snippet is restored on its own.


Regular expressions#

With Regular expression ticked, Search for is a PCRE pattern without delimiters — write btn-(primary|secondary), not /btn-(primary|secondary)/. Case sensitive off adds the i flag. Replace with can use the captured groups as $1, $2…

Search for:   https?://old-api\.example\.com/v(\d+)
Replace with: https://api.example.com/v$1

An invalid pattern stops with Invalid regular expression and says why — nothing is searched or changed.


Notes#

  • ⚠ Replacing inside PHP changes code that runs on your site. Read the previewed matches before confirming, and keep the replacement as specific as you can — a short search string can match more than you expect.
  • The page is available to the same users as the rest of WP Coder — administrators who can post unfiltered HTML.