Missing line breaks in ACF Text Area

Hello, multiple times I ran into the problem that after loading an ACF Text Area the line breaks are missing. For the ACF field I have the option "Automatically add <br> ” activated. ACF states that every line in the text area gets an <br> at the end : ACF Documentation

But if I load the Field with <Field acf-text-area /> I just get all the text from the text area in one line.

What can I do to keep the line breaks? Any help is appreciated. Thanks a lot!

I just tested, and I seem to get the same result.

I thought maybe L&L stripped out the <br /> tags, but you can actually type <br /> into the field, and they will render as line breaks. So that is not the case. It might actually be an issue from ACF. See here.

Anyways, I found that you can add a WYSIWYG field and use <Field acf_editor=fieldname /> and it will work.

1 Like

Hi, thanks a lot for your effort! Is this the solution? Is there no other approach than swapping the field? In the normal text area field the line breaks just disappear? Would like to stick with the text area but if there is no workaround …

If the issue does indeed come from the ACF plugin, then there is no other way. If the breaks are not being provided by ACF, there is no way for L&L to know.

1 Like

That is true. Can we somehow furthermore check if the breaks are definitely not being provided by ACF? Or do we assume it, because we’ve both tested it and it seems that way?

Hi, I just tested it, and it is indeed bizarre! I have passed this on to the developers, and I’ll let you guys know when it’s fixed!

Hi Emma, thanks a lot!

1 Like

Hey @emma and @spooniverse

I did some more testing and found a solution that seems to work!
If you add white-space: pre-wrap; in your css, it will work with the line breaks.

<p style="white-space: pre-wrap;"><Field acf_field=textaera /></p>
2 Likes

That does the trick! Thank you for your help.

2 Likes