Appearance
Search & Replace
Search and replace across posts, meta and options.
kitloom/ · admins: kitloom/, kitloom/
Video lessons
Recorded in the Filament admin; the Nova admin works the same way.
Search and replace across the site's tables, as Better Search Replace does it on WordPress: moving a site to another address, renaming a brand, fixing a link everywhere.
The admin is kitloom/search-replace-filament or kitloom/search-replace-nova (its own Search & Replace section).
A run
- Pairs: "search for → replace with", applied in turn.
- Tables: the declared ones the run is asked for; in each, every text column but the key.
- Case-insensitive, off by default.
- Replace GUIDs, off by default: a post's
guidis its identity for feed readers, and WordPress says leave it. - Dry run, on by default: the report shows what would change and nothing is written; the same search then runs for real.
Serialized values are changed without unserializing them: strings get their new lengths, keys and property names stay, and objects of classes the application does not have survive. A serialized string inside a serialized value is walked too. % and _ in a search are characters, not a pattern.
The report: per table the rows and cells changed, the replacements made, and the first changes with their values before and after.
php
use Kitloom\SearchReplace\RunOptions;
use Kitloom\SearchReplace\SearchReplace;
$report = app(SearchReplace::class)->run(new RunOptions(
[['search' => 'https://old.example', 'replace' => 'https://new.example']],
['posts', 'postmeta', 'options'],
dryRun: false,
));bash
php artisan search-replace https://old.example https://new.example # a dry run
php artisan search-replace https://old.example https://new.example --run # for realRuns from the admin are kept in search_ with who ran them and the report, and performed on the queue when the application has one.
Revisions
Revisions are left alone: they are what the records were. A run for real first keeps each record it rewrites as it is, as a revision of a type that keeps them (kitloom/wp-schema's Revisions::), and the save after the run keeps the new one — so a run can be taken back record by record.
Tables
kitloom- declares them by their models in the registry — the table and its prefix are the application's: posts, post meta, comments and their meta, terms, term taxonomy and meta, options, user meta. columns lists the columns instead of every text one, exclude leaves some out, false takes a table away. A module adds its own tables in its provider. Tables nobody declared — the application's users, sessions, jobs — are never touched.
AI agents
With kitloom/ai installed, an agent whose user has manage_ counts a change first (search_ — up to 5 pairs, the tables, every allowed one by default), then makes exactly the change it counted (search_ with the dry run's id — only a finished dry run that found something), and reads the history with each run's report (search_). A dry run changes no content, but it is kept in the history like every run and its scan reads every text column of the tables it is asked for, so it counts as a change: a read-only key does not have it, the assistant asks you before it, and one user gets kitloom- of them (5; 0 — no limit). There is no undo but a run the other way, so the agent is told to show the dry run's report first. An agent searches the content tables only — posts, comments, terms and their meta: options and user meta hold what kitloom/ai keeps from agents (the locked settings, secrets, roles, second factors), so a search there would show it and a run would rewrite it. Those, and a module's own tables, are searched from the admin; a run an admin made over them shows an agent only its status, and an agent does not run it again. kitloom- false — no search and replace tools.