I have a function that automatically adds a span around my headings so that I can style the span, eg:
<h2><span>my heading</span></h2>
This works fine in my normal Wordpress content, but content within the Advanced Custom Fields strips it out. Has anyone any ideas - have spent hours googling.
//add span into each title so can add flourish under span
add_filter('the_content', 'replace_content',1);
function replace_content($content) {
$content = preg_replace( '/<h(\d{1,6})(.*?)>(.*?)<\/h(\d{1,6}).*?>/', '<h$1><span>$3</span></h$4>', $content );
return $content;
}
Many thanks to anyone who can help!!