Disable outputting <p> tags when outputting content in ACF’s WYSIWYG editor

Advanced Custom Fields (ACF) is a WordPress field management plugin that offers many custom field types, including a WYSIWYG (What You See Is What You Get) editor. However, the output from ACF’s WYSIWYG editor defaults to HTML format, including <p> tags.

To remove HTML tags from ACF, set the second and third arguments of the get_field or the_sub_field functions to false. This will cause the field values to be output as plain text without HTML tags.

the_sub_field('description', false, false);

This code removes the HTML tags from the subfield named ‘description’ and outputs it. The second and third arguments, false, are to disable the formatted value and the automatic paragraph generation.

For more information, please see the following reference links

Advanced Custom Fields Official Documentation

Leave a Comment

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

Scroll to Top