How do I disable wpautop for a specific block?
I've registered a custom editor block with Advanced Custom Fields (ACF), and am using render_template
with a PHP template partial to display the block contents.
Inside the template is some HTML (section
with a figure
and an a
inside it). When the block is called and the template generates the HTML, it's exactly as I author it, but when displayed on the front end, the a
gets wrapped in a p
tag, and a couple of br
elements are added (I assume from wpautop()
). This isn't happening on the editor side, just on the front end, which leads me to believe the block HTML is getting run through the_content
or some other filters that run wpautop()
before display.
I've tried running the block content through buffering, which breaks the editor but fixes the front end, and tried disabling wpautop
from running in the_content
filter, but have had mixed results.
So my question is how to tell WordPress that I like my markup, thank you very much, and please leave it alone for this specific block?
Here's a Gist of the block template: https://gist.github.com/morganestes/eca76cf8490f7b943d2f44c75674b648.
Topic block-editor post-editor wp-autop Wordpress
Category Web