Home Forums General Issues Removing Paragraph Tags Reply To: Removing Paragraph Tags

  • Here is the solution I have used to remove the stray p tags when using shortcodes in the ACF WYSIWYG (put that in your functions file).

    function wpex_clean_shortcodes($content){   
        $array = array (
            '<p>[' => '[', 
            ']</p>' => ']', 
            ']<br />' => ']'
        $content = strtr($content, $array);
        return $content;
    add_filter('acf_the_content', 'wpex_clean_shortcodes');?>

    So far, I have not had any problems with this solution.