How to enable the WordPress media Trash feature

How to enable the WordPress media Trash feature featured image

Reading Time: 1 min, 21 sec

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.

WordPress media Trash

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 WordPress Hosting

Bluehost is one of the best and secure WordPress 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.

enable the WordPress media Trash feature

Now you can trash media files and recover them from the trash within 30 days if you want.

Wrap Up

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.

Deepanker profile image

Written by Deepanker

Deepanker Verma is an experienced WordPress developer who has been working on WordPress for more than 12 years. On TheWPGuides, he writes about WordPress, WordPress development, and WordPress plugins.

Leave a Reply

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

Need a Hand with Your WordPress Site?

Don't let technical issues slow you down. Our professional WordPress maintenance service handles updates, security, and performance optimization so you can focus on what you do best: creating content.

Learn More About Our Services