In WordPress 2.9 one of the new features is the ability to send posts, pages, and comments to trash instead of simply deleting them as in previous versions.

One thing about this new feature that is not so obvious, is that by default, items in trash are automatically deleted after 30-days. Of course, this could be a good thing as long as you know about it, but it could catch some by surprise who don’t know about this auto-delete feature in trash. I would imagine there are some who will use the trash as a holding place for posts, pages, or comments that they may want to remove from public view, but keep handy for possible future use. In the past, you may have just changed the status of a post or page from “Published” to “Draft” or simply “Unapproved” a comment to achieve the same result. The difference is, your draft posts/pages and unapproved comments were never deleted unless you deleted them–not so when you send something to trash. The 30-day delete time is defined in wp-settings around line 570–see screenshot below.

Of course, now that you know this, if you wanted to change it, you could open wp-settings and edit it there–changing the 30 to 60 would auto-delete items after 60 days. However, there is a better way to accomplish this so that you don’t over-write your changed during an upgrade, by defining this variable in the wp-config.php file. So, if you want to increase, decrease, or even disable this feature, you should open your wp-config.php file and include a line somewhere just like you see highlighted in the screenshot above. A good place to add the line would be directly below where the table prefix is defined in the wp-config.php file. The screenshot below shows wp-config.php edited to auto-delete items in the trash after 120 days.

But what if you want to completely disable the new trash feature? Changing the value to 0 (zero) will do that for you. The screenshot below shows how to edit wp-config.php to completely disable trash so that when you delete an item it is automatically deleted just as it was prior to version 2.9.

But note, if you disable trash, then when you click to delete something you will NOT be prompted to confirm…when you click Delete the item simply gets deleted and there is no getting it back without a backup.
Recent Comments