Is there any way to “clean” the output of an image caption? We have a site that uses an ACF gallery field that’s output via the L&L slider. If an editor adds a html tag to the image (eg: as a creative commons reference etc…) but fails to properly close it, it causes problems for the rest of the page.
Obviously in an ideal world there wouldn’t be errors, but a typo meant they used <a>
instead of </a>
to close it so we just want to try and add in a layer of protection against future errors.
This it the code we’re using
<Slider>
<Loop acf_gallery=stadium_images>
<Slide>
<div class="image_slide">
<img src="{Field url}" alt="{Field alt}">
<div class="image_text">
<Field alt />
<If field=caption exists>
<br>
<em><Field caption /></em>
</If>
</div>
</div>
</Slide>
</Loop>
</Slider>