What is the Trash?
When you delete a post, page or comment in WordPress, it does not vanish right away. It goes to the Trash, like a recycling bin on your computer. You can bring it back from there if you change your mind.
By default, WordPress empties the Trash by itself after 30 days. Items older than that are removed forever. If you want a shorter or longer time, you can change it. You do this with a small piece of code in the wp-config.php file. That file holds the main settings of your WordPress site.
Empty the Trash by hand
- Go to Posts, then All Posts.
- Click the Trash link above the list.
- Click Empty Trash.
Warning: this deletes the items forever. You cannot undo it. Check the list first.
Pages and comments have their own Trash links in Pages and Comments.
Change the number of days
Warning: a typing mistake in wp-config.php can break your site. Take a backup of the file before you start.
- Log in to your hosting control panel and open File Manager. You can also use an FTP program.
- Open the folder where WordPress is installed. This is often
public_html. - Right-click
wp-config.phpand choose Edit. - Find the line that says
/* That's all, stop editing! Happy publishing. */. - Just above that line, add this:
This tells WordPress to empty the Trash every 7 days. Change the number to the days you want.define( 'EMPTY_TRASH_DAYS', 7 ); - Click Save Changes.
Turn the Trash off completely
If you set the number to zero, items are deleted at once and skip the Trash. There is no way back.
define( 'EMPTY_TRASH_DAYS', 0 );
This line makes every delete permanent. Only use it if you are sure.
Use a plugin instead
A plugin is an add-on for WordPress. If you do not want to edit files, you can use a cleanup plugin. Go to Plugins, then Add New, and search for a database cleanup or trash plugin. Many let you set a schedule. Read the plugin settings carefully before you run it.
Quick recap
- Deleted items go to the Trash first. WordPress empties it after 30 days.
- Change the time with
EMPTY_TRASH_DAYSinwp-config.php. - A value of 0 turns the Trash off, and deletes cannot be undone.
- Always back up before you edit the file.