spacedmonkey/wp-rest-blocks

When using a WYSIWYG field in ACF blocks, it doesn't auto add P tags

Opened this issue · 1 comments

Falko 2023-12-18 at 21 59 51@2x

I've uploaded a screenshot above. When using a WYSIWIG field in ACF blocks, it doesn't seem to add P tags automatically after you press a newline.

I think WordPress handles auto-adding paragraphs in PHP by using a WordPress filter.

Would it be possible to support that? I think a lot of people use the WYSIWYG field inside ACF blocks to insert long text. But it's difficult to format in a front-end when there are no paragraphs.

I think the filter is called wpautop. See here: https://developer.wordpress.org/reference/functions/wpautop/

Other than that nice work with this plugin, this should be in core for sure. You're helping out a lot of folks who are using headless WordPress with Gutenberg as the editor. 🙂

Just found this native Javascript port of wpautop which does the exact same.

I'm using this library in the front-end, if anyone else has the same issue as I did:

https://github.com/andymantell/node-wpautop

So for me this issue is solved. Feel free to close, if you're not planning on handling this formatting within the plugin.