Home Forums General Issues How to get rid of extra lines from ACF WYSIWYG content! Reply To: How to get rid of extra lines from ACF WYSIWYG content!

  • None of the shortcodes that you have in your question are valid ACF sortcodes, unless you are using some other plugin or something that makes them valid. Are these from one of the other plugins you mentioned?

    But that is neither here nor there, as you stated, the extra breaks and lines are being added by wpautop(). This filter works on the entire content of the WYSIWYG field and altering the individual parts of the content will have no effect.

    The wpautop filter is run when ACF formats the value.

    What you need to do is to remove that filter for the specific field. Since you are using elementor I’m assuming that you cannot modify the code that actually outputs the value of the field. Unfortunately, without modifying the code where the value is output there really isn’t any way to do this without affecting every field.

    Using PHP I would remove this filter before I got the field and then add the filter back so that it did not affect other fields.

    remove_filter('acf_the_content', 'wpautop');
    $value = get_field('field_name');
    add_filter('acf_the_content', 'wpautop');

    This cannot be done in elementor.

    Using elementor I would likely try using a textarea field and add a filter to ACF that would cause ACF to do shortcodes on this particular field. There is an example of doing exactly this in the documentation for acf/format_value.