• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

We’ll become available for new work in early October 2023.

Questions? Call 254.340.0086 or send an email to jon@elod.in.

Elodin Design

WordPress Design & Development

  • About
  • Websites
  • Services
  • Process
  • Blog
  • Repos
  • Contact

Gutenberg is breaking ACF blocks: here’s how to fix it

January 25, 2019 by Jon Schroeder Leave a Comment

Based on a number of github threads like this one, I’m not the only one experiencing this issue: WordPress is adding <p> tags willy-nilly throughout code that shouldn’t have it.

What’s happening is this: the wpautop filter is firing double, essentially, if you ever use any of the following when rendering an ACF block for Gutenberg. That means it’s wrapping every line with <p> tags in every block on the page, if any of the blocks use any of the following to render:

  • Core WordPress function the_content()
  • Core WordPress function the_excerpt()
  • Core WordPress filter ‘the_content’
  • ACF core function the_field()

To make things worse, even if you’re getting around all of these, but there are any shortcodes inside your ACF content area (for example, outputting which do use any of the above, then the whole page will still break.

Here’s what you can do to put a bandaid on this:

I think it’s possible there’s a better solution out there, something along the lines of Elliot Conden’s example here, but I don’t want to add complexity to troubleshooting this later on the assumption that Gutenberg will eventually fix this.

There’s been a Trac ticket awaiting review on this topic for the last 8 weeks, so hopefully they get to that soon.

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

About the blog

I’ve always been exceptionally bad at actually sitting down and writing blog entries, so do me a favor – please feel free to comment or drop me a line if you have something you’d like me to write about (or just to say hello).

Browse by category

  • Advanced Custom Fields
  • Gutenberg
  • Perspective
  • Tutorials & how-to guides
  • Updates

Centered and full-justified text on the internet

How to add contextual styling in the Gutenberg editor

User interface is really important

How to connect Gravity Forms with Salesforce web-to-lead using Gravity Forms’ Webhooks addon

Reviewing SpinupWP and why I closed my account

Ready to get started?

There’s no pressure. If you’re interested in building a site, please feel free to reach out – and I’ll talk through your project with you and give you some pointers even if we don’t end up working together.

Reach out

Elodin Design, Inc. (formerly Red Blue Concepts)
Website design & development · Custom WordPress theme and plugin development
3305 Fox Hollow Circle, Waco, TX 76708 · (254) 340-0086
Copyright © 2023 · All rights reserved.