Remove image in post when it’s removed in media library

I was not able to find plugin for that and I think there might be a problem to find one.

Problem is not easy to solve because as I just checked in WordPress database reference (http://codex.wordpress.org/images/9/9e/WP3.0-ERD.png) there is not special container for images in post content.

If I understand correct your plugin needs to:

  • hook to action when media is removed,
  • search through all your posts looking for image url,
  • find in post content image url and html ‘a’ tag for it,
  • remove ‘a’ tag with image tag

It is not soo hard to write it but performence of plugin depends on how many posts you have on your blog.