Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text with escaped slashes etc in Block text fields can't be found #66

Open
noahkuhn opened this issue Apr 13, 2020 · 1 comment
Open

Comments

@noahkuhn
Copy link

This is the first time I've used the new Blocks capability on a build. I'm creating my blocks via ACF Pro. Within some of the blocks I've created, I have simple WYSIWYG text fields, and within those, obviously you can create links or add images etc.

When that data is saved to the database, it gets saved in a JSON object and HTML within the text field has parts that get escaped. Seems primarily to be the slashes, probably other things as well. So for example:

<!-- wp:acf/introduction { "id": "block_5e8cb5c59c4b3", "name": "acf\/introduction", "data": { "text": "<a href=\"http:\/\/testwebsite.test\/part-one\/part-two\/\">Learn More<\/a>", "_text": "field_5e6900ce032f4", } } /-->

So now I go to do a find replace on http://testwebsite.test and it doesn't find it because it's been escaped. Seems that Better Search & Replace needs to be tweaked such that escaped slashes (and whatever else is relevant) are sorted out and you can find things within these Block content fields.

@erikyo
Copy link

erikyo commented May 24, 2024

First of all, thank you for your plugin, it has often been useful to me.

However, I would like to mention that I also find myself having to replace URLs multiple times if they contain slashes due to the escaped version in the JSON. It would be great to have an option (maybe under "ADDITIONAL SETTINGS") that adds this feature, for example, a "Search also the escaped string"

I add here a test case, the recently introduced wp_font_face posts type that copy the site url into the saved json, you can find it with SELECT 'post_content' FROM 'wp_posts' WHERE 'post_type' = 'wp_font_face' (after saving a custom font)

{
    "fontFamily": "exampleFont",
    "fontStyle": "normal",
    "fontWeight": "300",
    "src": "https:\/\/mywebsite.com\/wp-content\/uploads\/fonts\/example.woff"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants