eUKHost
iContact (AutoResponder)
ElegantThemes
HobbyTron
This site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies. Find out more.

How to Limit and Disable Trash Feature in WordPress

 Posted by  Add comments
 

How to Limit and Disable Trash Feature in WordPress

How to Limit and Disable Trash Feature in WordPress Introduction

In the far distant past, WordPress 2.9 introduced a new feature which allowed users to Trash a post instead of deleting it. If you look in the comment section of WordPress 2.9 and above, you will see the old delete link has been replaced by the Trash link in the comments bar and the post edit menu.

By default WordPress 2.9 and above will keep Trashed posts for 30 days prior to deletion. You can of course delete the trash at any time manually by clicking on the Trash(#) link. Be warned, if you have a large number of posts in Trash you might find your system times-out when trying to empty the Trash can. In such cases, just refresh, and empty the trash again. Each time you will remove several hundred trash posts. Just keep going until it’s empty.

New WordPress Trash Feature

Post WordPress 2.9 now has Trash feature, replacing the old Delete link.

Change Trash Retain Period

Unfortunately in the 30 day default trashing period, the trash file can grow quite large (over 7000 items the last time I left mine – all posts go to trash unless they are related to the article). This can slow data retrieval and increases the size of your backup file considerably.

Regrettably, WordPress did not install a menu item to enable users to set the number of days trash should be retained. Fortunately, the did enable you to specify a time period for trash disposal in the wp-config file. So, to curb (or extend) the number of days trash is stored in your database, add the following line to your wp-config.php file.

define('EMPTY_TRASH_DAYS', NUMBER_OF_DAYS);

Where you would replace NUMBER_OF_DAYS with the number of days you desire for trash disposal.

Disable Trash Feature

If you do not want the trash feature at all, you can always disable it by defining NUMBER_OF_DAYS as zero. Once again, you will need to add a line to your wp-config.php file. The following is the code I use in my wp-config.php file.

/**
* Empty Trash (default 30 days)
*
* define('EMPTY_TRASH_DAYS', 0 );  // zero days
* define('EMPTY_TRASH_DAYS', 1 );  // one day
* define('EMPTY_TRASH_DAYS', 7 );  // seven days
* define('EMPTY_TRASH_DAYS', 14 );  // fourteen days
*/
define('EMPTY_TRASH_DAYS', 0 );  // zero days

Defining NUMBER_OF_DAYS as zero will ensure no posts are stored in the trash and additionally remove the Trash(#) link in the comments bar plus add ‘Delete Permanently’ to each post edit menu.

New WordPress Trash Feature Disabled

The Trash feature disabled and replaced by ‘Delete Permanently’.

How to Limit and Disable Trash Feature in WordPress Conclusion

Well, I hope you found something useful and enjoyed this article, How to Limit and Disable Trash Feature in WordPress.


KingSolutions.org.uk is hosted on JustHost

 Leave a Reply

(required)

(required)

186 queries in 0.925 seconds (Child).