Support

Account

Home Forums General Issues wysiwyg adding after each shortcode

Solved

wysiwyg adding after each shortcode

  • Hi there,

    I’m having an issue with the wysiwyg custom field adding <br/> after each shortcode I add. I’ve added the exact same code to the wordpress editor and it displays correctly.

    So does anyone know how I can remove the unwanted <br/> from wysiwyg as its really messing up the layout.

    Thanks,
    Jason

  • I found the answer if anyone else is interested by adding this to functions.php

    remove_filter ('acf_the_content', 'wpautop');

  • Here’s another why to do this:

    add_filter('acf_the_content', 'shortcode_empty_paragraph_fix');
    function shortcode_empty_paragraph_fix($content) {   
    	$array = array (
    		'<p>[' => '[', 
    		']</p>' => ']', 
    		']<br />' => ']'
    	);
    
    	$content = strtr($content, $array);
    
    	return $content;
    }
Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘wysiwyg adding after each shortcode’ is closed to new replies.