Since WordPress adds paragraph tags on everything, I need to strip paragraph tags under certain conditions. In this case, I want them off the images. I got that part working:
$(".scroller img").unwrap();
But I think that WordPress might not add paragraph tags around images forever, so then my code would break, and it would strip the parent instead, which I don’t want.
How can I make a check on this, that says “if parent tag is p on the image, then strip it”?
Or how to tell WordPress not to wrap paragraph tags around solo images would be ok too. 🙂
Thanks!
This will select and unwrap only img tags with p parents(inside of .scroller)