Support

Account

Home Forums Front-end Issues Paragraph wrapped in empty tags

Solved

Paragraph wrapped in empty tags

  • I’m using WYSIWYG fields within Flexible Content blocks. I’m running into an issue which is messing up my layout. The content I put in the WYSIWYG field – in this case just 1 paragraph – is being displayed correctly. However, it’s showing as follows in the HTML code:

    <p></p>
    <p>My written content is here</p>
    <p></p>

    These empty tags are using up extra space, thus messing up my layout.

    I’ve found solutions online to turn off ‘wpautop’ but the way I understand it, that would completely stop ACF from wrapping the content in a tag, which is not what I want.

  • So it turns out I was calling the text as follows:
    <p><?php echo $text; ?></p>
    But because the WYSIWYG already includes p-tags, for some reason WordPress/ACF then decides to add empty p-tags before AND after the paragraph.
    Anyway, I removed the p-tags from my code and now it’s working as intended 🙂

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.