Home Forums Front-end Issues Solving the ACF shortcode extra tag issue


Solving the ACF shortcode extra tag issue

  • I think I’ve read just about every post there is (and there are a few) about the issue whereby extra P tags (and therefore spaces) are added when I add an ACF field in Gutenberg via shortcode.

    For example:

    I add this to a Gutenberg shortcode block:

    [acf field="my_field"]

    It is just a simple text field.

    When it outputs, a <p></p> is added above it, and a <p></p> is also added below it.

    I have searched and searched and nothing I have tried has worked to stop the generation of these extra P tags.

    I’m hoping someone with more ACF expertise than I can hep me by telling me what will prevent this. I’m guessing it is a functions snippet, but I have tried several.

    For instance, this function doesn’t work:

    remove_filter ('acf_the_content', 'wpautop', 20);

    Any help is appreciated.
    (Using ACF shortcode calling an ACF text field (not even a WYSIWYG field) in Gutenberg. No non-Gutenberg page builder involved.)

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.