Home > WP 2.9 > WordPress 2.9 Trash Feature — How to Customize

WordPress 2.9 Trash Feature — How to Customize

January 2nd, 2010 Leave a comment Go to comments

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.

Share and Enjoy:
  • PDF
  • Print
  • email
  • Facebook
  • MySpace
  • Google Bookmarks
  • StumbleUpon
  • del.icio.us
  • Technorati
  • Digg
  • Sphinn
  • Mixx
  • Blogosphere News
  • Slashdot
  • Yahoo! Bookmarks
  • Faves
  • Live
  • MSN Reporter
  • MyShare
  • Yahoo! Buzz
  • blogmarks
  • FSDaily
  • Reddit
  • Twitthis

Related posts:

  1. WordPress 2.9 New Features WordPress 2.9 should be released near the end of the...
  2. Customize WordPress Post Revisions In a default install of WordPress, each time you edit...
  3. WordPress Comment Moderation Note: The following is made available under GPL from http://codex.wordpress.org/GPL....
  4. Overview of WordPress 2.8 Database Tables Note: The following is made available under GPL from http://codex.wordpress.org/GPL....
  5. WordPress 2.9.2 Released — Bug Fix WordPress 2.9.2 was just released and addresses a bug where...

Categories: WP 2.9 Tags: ,
  1. January 27th, 2010 at 16:15 | #1

    Hi, like you, I’m an educator and I really appreciate you sharing your knowledge online.

    I’d like to change my “trash” to 60 days, but I can’t find the correct wp-config.php file (folder?). I found one, under the /public_html/ but when I opened that file, there was nothing there (re trash).

    I had previously looked under content/themes/pixel and couldn’t find it on any of those levels.

    Can you point me in the right direction?

    Thanks

    Dean

  2. January 27th, 2010 at 17:10 | #2

    @Dean A. Nash: You will only have one wp-config.php file…open the one in public_html and if the code for trash isn’t there, just add it.

  3. January 27th, 2010 at 17:39 | #3

    I got it, thanks. I just needed that little extra push from you to get past my mental blockade. Don’t know why I didn’t quite catch it the first time, it is all there. Sorry to trouble you.

  1. February 26th, 2010 at 19:31 | #1
Get Adobe Flash playerPlugin by wpburn.com wordpress themes