How to stop unlink images when remove a site or user

What’s the best way to prevent images deleting?.
I have a central cdn site to share images to several sites on wordpress multisite, and by mistake, I have remove a user from the network and all my media files has been deleted.

I think thats enough, hooking a filter to wp_delete_file to prevent stop unlink

$file = apply_filters( 'wp_delete_file', 'my_custom_wp_deletefile' ); 
my_custom_wp_deletefile() { 
   return false;
} 

But I don’t know if I need anymore.

0

Leave a Comment