better-search-replace
better-search-replace copied to clipboard
Option to avoid changing block names
Problem
I just used BSR to change all instances of Verse
to Step
then ran it again to change all instances of verse
to step
.
Then I noticed something strange.
What should have been Verse blocks were now appearing as Classic, with preformatted blocks within them.
Explanation
I'd accidentally changed wp:verse
to wp:step
.
Expected result
All instances of the word Verse
to be changed to Step
in post content.
All instances of the word verse
to be changed to step
in post content.
Actual result
The block type names were changed as well.
Requirement
It would be nice if there was an option to NOT change block type names. Or at least a warning.
Is this part of the Pro version?
Workaround
Run BRS again changing wp:step
to wp:verse
.
PS
The irony is that I'd run BRS against my Problem Solving website. So, I can now use this Issue as a problem solving example. https://bobbingwide.com/problem-solving/oik_presentation/steps/step-13-whats-changed/
PPS
I also created a problem with permalinks; by changing verse
to Step
.
BTW: The workaround didn't work. My blocks had become wp:Step
and they included a pre tag with class wp-block-Step
.
You may just find the following code useful. https://github.com/bobbingwide/oik-clone/blob/master/admin/class-oik-clone-block-relationships.php
It contains logic to parse post_content into blocks ( using WordPress core functionality) then reform post_content from the parsed blocks.