Automatically empty wordpress Trash comments and posts

WordPress tutorial, Automatically empty wordpress Trash comments and posts. Many times manually checking the deleted comments and posts is painful.  We need to keep our wordpress database clean so wordpress will perform faster.

Automatically empty wordpress Trash comments and posts

wordpress API provided to clean the commant and post trash automatically.
We just need to put following code in your worpdress configuration file.

Open your wp-config.php file and put following code in that file. After following line you can put the code.
define(‘DB_COLLATE’, ”);


define('EMPTY_TRASH_DAYS', 30 ); //assign the number of days

Be careful about assigning the days because after 30 days your trash will be deleted from database. So you cannot restore post or comments again from wordpress trash panel.

Published by

Purab

I am Purab from India, Software development is my profession and teaching is my passion. Programmers blog dedicated to the JAVA, Python, PHP, DevOps and Opensource Frameworks. Purab's Github Repo Youtube Chanel Video Tutorials Connect to on LinkedIn

Leave a Reply

Your email address will not be published.