Support

Account

Home Forums General Issues Filtering content inside shortcodes? Reply To: Filtering content inside shortcodes?

  • ACF does not run ‘the_content’ on wysiwyg fields. Add a second filter

    
    function the_shortcode_filter($content) {
        $block = join("|",array("columns", "first", "second", "block-bullets", "loan-terms-from"));
        $rep = preg_replace("/()?\[($block)(\s[^\]]+)?\](<\/p>|<br \/>)?/","[$2$3]",$content);
        $rep = preg_replace("/()?\[\/($block)](<\/p>|<br \/>)?/","[/$2]",$rep);
    return $rep;
    }
    add_filter("the_content", "the_shortcode_filter");
    add_filter("acf_the_content", "the_shortcode_filter");