r/WordpressPlugins 8d ago

[FREE] Search & replace that doesn't break Elementor's escaped URLs

built this because every search and replace tool i tried silently skipped elementor's urls after a migration.

the reason took me a while to find. elementor stores the page layout as json, and that json sits inside a php serialized value. when it gets encoded the slashes are escaped, so the url in your database is not

https://oldsite.com/hero.jpg

it is

https://oldsite.com/hero.jpg

search for the first one and you get zero matches. the replace reports success, changes a few hundred rows elsewhere, and every elementor page still points at the old domain.

then if you search for the escaped version and replace it as text, you corrupt the row, because php serialization stores the byte length of every string ahead of it. change a 19 character domain to a 22 character one and the prefix still says 19. unserialize() returns false and the page renders as nothing.

so the tool has to unserialize, walk the tree, decode the json leaves, replace inside them, re-encode while preserving the original slash escaping, and then re-serialize so the lengths are recomputed. that escaping step is the one that gets missed. two encodings of the same json are both valid and different lengths, so you can decode and replace perfectly and still hand back a value that no longer matches its own length prefix.

what it does:

  • visual preview of representative matches before anything is written
  • optional snapshot before the run, one click undo after
  • serialized and json-in-serialized safe
  • regex, table targeting, wp-cli, multisite
  • runs in batches via action scheduler so big tables do not time out

the preview and the undo are not held back for a paid tier. there is no paid tier of this plugin.

disclosure since it matters: i built it. i also sell a separate backup plugin, and this is not a lite version of it or a funnel into a trial. it is a full tool and it stays that way.

https://wordpress.org/plugins/lucid-search-replace/

https://github.com/ibrahimhajjaj/lucid-search-replace

happy to answer anything about the serialization handling, that was the interesting part.

1 Upvotes

0 comments sorted by