Up!
I’ve managed to apply IDs to all WYSIWYG fields, but how could intercept a specific field with its key?
this is the code applied:
function my_heading_ids($content) {
$content = preg_replace_callback(“/\<h([4])/”, function ($matches) {
static $num = 1;
$hTag = $matches[4];
return ‘<h4′. $hTag .’ id=”my’ . $num++ . ‘”‘;
}, $content);
return $content;
}
add_filter(‘acf_the_content’, ‘my_heading_ids’);
Thanks