WordPress has Trash feature where was a place to put something that you no longer want such posts, pages and comments. If you click ‘Trash’ it will be sent the item to the trash. and it remains there for 30 days (by default) before being permanently deleted.
This code snippet will let you delete trash by WordPress built-in constant.
Steps to automatically empty trash in WordPress:
- Open wp-config.php file, if you work localhost open the same file using any code editor IDE
- Add the following code at the bottom of the file.
- Save the changes.
define('EMPTY_TRASH_DAYS', 3 );
Did you find the WordPress snippets in this article helpful? Share it with your friends and if you have any questions and want to ask us about it, please don’t hesitate to add comments.