I need to remove the autop formatting that goes around tags ONLY in the WYSIWYG field. So far I have the following, but no luck:
add_filter ('acf_the_content', 'img_p_class_content_filter', 20);
function img_p_class_content_filter($content) {
$content = preg_replace("/(<p[^>]*)(\>.*)(\<img.*)(<\/p>)/im", "\$1 class='clear'\$2\$3\$4", $content);
return $content;
}
It does get rid of the <p> tags, but replaces them with <p class=”clear”> tags