How to Remove Child Attachments When Parent Post is deleted in WordPress

WordPress have been working to make the web a lot easier for everyone. Recently WordPress just released a new version update 4.3 ‘Billie’ and we really loved it. Like I said, WordPress team have been working to make the web easier and every one can develop their sites by themselves. 🙂

So, today what I’m gonna tell you about WordPress is: how to remove unattached media files automatically in WordPress, so you WordPress media library don’t get messy but clean all the time. We had already published an article about How to Cleanup Unused Images from a WordPress Blog but today’s tutorial is a little different.

Remove Child Attachments When Parent Post is deleted in WordPress

When we delete any article from posts/pages or custom post type we just remove the article but we don’t remove the images from media library that are actually saved in your web hosting server. So the thing is people can actually see the images while you have removed the article and that’s something not good.

This can harm you in many ways like suppose if wrote an illegal article and uploaded the illegal images in your post then you asked to remove the article but the illegal images are still there in server which should be removed otherwise you might get charged by the Government or the authority… 🙁 This is why you should use the remove child attachments when you have parent post/page or custom post type removed.

Autoremove Attachments WordPress
Autoremove Attachments

Autoremove Attachments

Autoremove Attachments helps you keep your media library clean by deleting all media files attached to a post when that post gets removed from your website. By default, WordPress doesn’t remove child attachments leaving orphan files behind. Using this plugin you won’t have to manually track and remove them.

Related  How to Setup WordPress MU Blog from Scratch (In Existing WP Blog Too)?

So, after downloading, installing and activating autoremove attachments WordPress plugin you should not have to worry about removing attachments whose parent posts are removed because there is no configuration is needed by the plugin, it just works automatically.

Leave a Reply

Your email address will not be published. Required fields are marked *