Trash in WordPress is the equivalent of the recycling bin on your computer, or trash on your Mac. Users that have the proper permissions, for example editors and administrators, can delete a page, post, or comments.
When you get rid of something on WordPress, it is taken to the trash folder where it will stay for 30 days.
This means that within those 30 days if you need to restore an item you have deleted, you can do so. Once the 30 days is up, the item is automatically deleted from the WordPress database, and you will not be able to get it back.
This additional feature of trash was added into WordPress recently to reduce the chances of accidentally deleting your content.
If you want to restore an item you have recently deleted, go to your list item screen. If there are any items in your trash, then you will see a link of the trash page with the number of items next to it.
If you click on the link, you will see the list of deleted items. If you want to restore one of them, all you have to do is select it with your mouse, and you will have the option to either restore it or to delete it permanently.
How to Automatically Empty Trash in WordPress
As we mentioned above, trash in WordPress is more like a recycling bin now, as it will hold onto items for 30 days before deleting them permanently. Of course, this is definitely a feature that is going to benefit most WordPress users, especially if you have a habit of accidentally deleting items you intended on saving.
Of course, this feature means that WordPress trash automatically empties every 30 days, but the good news is that you can adjust this time frame to suit your personal preferences.
All you have to do to empty your trash weekly, daily, or whenever you want is to open up your ‘wp-config.php’ file.
Here you can see at the beginning of this code there is the number ‘1’. If you want to change the frequency of when your trash is emptied, then you need to change this number to however many days you want.
If you don’t want the trash to automatically empty itself ever, you can change the number to ‘zero’.
Where is the Trash Bin in WordPress?
Let’s quickly run through where the trash folder is in WordPress again, just so it is clear. To locate the trash folder, you go to ‘pages’, and then ‘all pages’. Again, if you have pages in trash, you will see a link to the trash folder that is displayed at the top of the page.
The Different Types of Trash
Something that you might not know about WordPress when it comes to the trash folder is that there are different categories for it.
This means that each type of WordPress content, including media, images, pages, and posts, have their own separate trash folders. This is another important piece of information to know about if you were are trying to restore an item that you have accidentally deleted.
As well as accessing the dashboard above and being able to see how many items are in the trash, just keep in mind that there are other folders out there that might contain more items you can’t recall even deleting.
How Trash Takes up Space
Of course, it’s incredibly helpful having the trash feature that allows you to recover items that are less than 30 days old. However, while this is convenient especially if you deleted something you didn’t mean to, it is important to know that this trash takes up space in your database.
This means that if your website receives a lot of traffic every day, or contains a lot of content, then the amount of space on the database that is taken up by trash items could be more significant than you realize. It could also be impacting your database’s performance.
This is why it is always helpful to have the option of changing the restoration period of WordPress trash. If you are someone who doesn’t tend to accidentally delete things too often, then you might be able to get away with reducing the 30 days to a week, or even two or three days.
This is going to clear up your database significantly, and help your website run a lot smoother in general.