I have been looking quite a long time for a way to stop people from posting external images in comments i e
<img alt="my photo" src="http://example.co.uk/pic.jpg" />
and the image is displayed, without permission from the owner. This is hard coded somewhere in core but I can’t find a way to unset this behaviour. Thanks!
You can strip images on display pretty easily.
That will strip any tags not listed in the provided array. To specifically strip images with links to external sources you need something more complicated.
That should allow users to add images to comments but only images hosted at same domain as the site itself.
I added iframe to your first function to allow embeds from sites like youtube and instagram. I reckon that is a secure way? It works as intended now. I am not sure what your second function accomplishes, the end result is the same with or without it. Perhaps I wasn’t clear enough about what I wanted to accomplish in my original question? Thank you very much. I will accept your answer.