How to enable the WordPress media Trash feature
If you delete WordPress posts or pages, WordPress moves them to Trash. WordPress has separate trash folders for posts, pages, and comments. So, you can recover accidentally-deleted posts or pages. Items are stored in the trash for 30 days before being deleted permanently. On the other hand, removing a media file is removed permanently. You don’t see the move to trash option for WordPress Media. It only says Delete Permanently. When you delete a media file, it is removed instantly.
What if you want to enable trash for media files, so you can recover accidentally images and other media files. To enable the Trash for media files, you need to add a single line of code in the wp-config.php file. This file can be found at the root of your WordPress installation. Edit this file and add the following code.
Best Managed WordPress HostingWPEngine is the best and most secure managed hosting provider
define( 'MEDIA_TRASH', true );
After you add this line in wp-config.php file, it will enable the trash for media files. See how the media section changes.
Now you can trash media files and recover them from the trash within 30 days if you want.
Now you know how to enable trash for media files. If you want to disable trash for media files, just remove that line from wp-config.php file.
I have written several useful WordPress guides on this blog. If you are new to WordPress, this blog will surely help you a lot. If you want to ask anything, you can leave a comment below.