using wysiwyg field type and displaying on frontend:
if i use: get_post_meta($post->ID, 'fieldname', true);
the value is without formatting and it displays as if all new lines were stripped out…
if i use: the_field('fieldname');
the value is formatted… but there are extra <br> tags and <p> tags in between things.
if i have a list then the list will have <br> in between each list element.
how to fix this issue when using the_field
i know the default “format_value” is ‘br’ but this doesnt work for the rich text/wysiwyg field type.
example of what happens:
<ul>
<li>item 1</li>
<br>
<li>item2</li>
<br>
<li>item 3</li>
</ul>
Although this seems to be an old topic, it looks like I have exactly the same problem.
get_post_meta
isn’t really a solution because it doesn’t wrap regular text in <p>
tags when you have mixed content in a wysiwyg field