Ivan Nukli
Ivan Nukli

Reputation: 57

Add /n to text in Wordpress (ACF)

I have situation where my output from Textarea field (acf) needs to be like this::

lorem ipsum blabla\nblbala\n\nlorem lorem

This is my ACF text field:

<?php the_field( 'content_new' ); ?>

this returns content like this:

lorem ipsum blabla <br> 
blbala <br> nlorem lorem

So my question is, can I output /n instead of <br> like on example:

lorem ipsum blabla\nblbala\n\nlorem lorem

Thank you all

Upvotes: 0

Views: 2220

Answers (1)

Boris  Volkovich
Boris Volkovich

Reputation: 115

First of all check that your textarea field setting new lines is set to "No formatting"

Also you can do this

<?php echo str_replace('<br>', '\n', get_field( 'content_new' )); ?>

Upvotes: 1

Related Questions