Delete WordPress Attachments when Deleting Post 1


I was trying to find a way to delete the media files attached to all WordPress posts when deleting a bunch of posts at once. I did not want to leave behind a bunch of media files once I got rid of the posts. Turns out there is a way to do this but you have to add some code to your functions.php file. Below is the code to add to functions.php. Be sure to delete this when you are done.

This snippet was found here: http://www.loneshooter.com/wordpress-deleting-images-when-deleting-post/

1
Leave a Reply

avatar
1 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
Vinicius Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Vinicius
Guest
Vinicius

It’s not working with wp 4.7.5.