Hi,
I have a strange problem since I updated the plugin to 1.58.4 (I tried going back to 1.58.3 and everything works again as expected):
Whenever I type a new line inside a widget form field textarea (via Shift + Enter) the new line is gone after I save the post. So for example if I write this inside a textea:
First
Second
After the save, the widget form field will display:
FirstSecond
I read in the change log for 1.58.4 that you guys Improved field sanitization”. Could this maybe be an unintended side effect of this change?
Hi Neubinho
Thanks for your post.
Unfortunately, the behavior you’ve described won’t be possible by default moving forward. We did our absolute best to accommodate existing workflows while tightening input sanitization. Using the Code Snippets plugin or perhaps the functions file in a child theme or even a custom plugin, the following can be introduced:
Page: Advanced Customizations
Apologies for the hassle. Please let us know how you get on. I’m sure we can assist in getting textarea behavior back to what it was.
Hey Andrew,
thanks for your quick reply!
I get that you filter out actual html tags like but that’s not what i meant. In my case after the save of the post all the linebreaks (\n) of the textareas are gone.
Say for example if I write something with a new line by pressing enter like here:
After I save the post, the new line inside the textarea is gone and it looks like this:
This seems like a wrong beheaviour for a textarea b/c new lines are what actually differs them from normal text inputs?
I’m sure that this behaviour is new with 1.58.4 b/c if I switch back to 1.58.3 everything works as expected.
sorry seems like my links are not working?
This is a screenshot from before the save:
https://autos-band.de/before_save.png
and this after
https://autos-band.de/after_save.png
Hi, thanks for your feedback. Apologies again for the hassle. The sanitization currently in place is in line with the way WordPress handles text areas. Did you perhaps have a chance to check the filter I sent? Once Code Snippets is installed, it should only take a moment to implement.
Hey Andrew,
yeah I tried the filter but it’s not helping because – as I was trying to explain through my screenshots – I’m not using HTML line breaks () and therfor the filter that is actually written to allow doesn’t work.
I merly press ENTER within a textarea this new line inside the textarea is not saved in the backend (see my screenshots for my last reply) … and I guess that is not in line with how WordPress handles textareas b/c for example If I press enter multiple times in the html quick view, these new lines are all there after the post save.
Thanks, I’m with you. Is the widget you’re using in your example a standard or custom widget? If it’s a standard widget, please let us know the name and we’ll work on the issue locally.
In order to confirm that it’s not a problem with a custom widget I searched for one of the standard widgets that actually uses the textarea form field.
The only one I found is the SiteOrigin Google Maps Widget. When you use “Predefined Styles” as map style, there is a text area labeled “Raw JSON Styles”.
If I enter something like this
“This is first
This is second”
it will save to the database like this:
“this is firstthis is second””
Here are two Screenshots to illustrate my point:
https://autos-band.de/widget_before_save.png
https://autos-band.de/widget_after_save.png
Hope you are able to confirm/recreate my problem locally.
Thanks for the example field. I’ll forward your feedback to Alex here at SiteOrigin. We’ll get back to you as soon as we know more.
Hi Neubinho,
I’ve identified a fix for this issue and prepared a patched version of the Widgets Bundle for you to try. You can download it by clicking here.
Before proceeding, do a backup.
Navigate to PluginsInstalled Plugins, and deactivate SiteOrigin Widgets Bundle, and then delete it. Scroll to the top of the page and click Add New, Upload Plugin and upload so-widgets-bundle.1.58.7-beta.zip.
This patch can’t retroactively restore linebreaks, but it will prevent them from being removed.
Kind regards,
Alex
Hey Alex,
just tested it and the patched version works like a charm: The textarea keeps the line breaks after I save a post.
Thanks for the quick replies and the fix to you and Andrew!
Thanks for your help with this issue; much appreciated!