WP Rocket - WordPress Caching Plugin

When you delete a post, page or comment in WordPress, it will be sent to Trash, where it will remain for 30 days in case you’ll want to restore it.

wordpress trash

Even if it’s a useful feature in case you delete something by mistake or change your mind, I still get annoyed that I also have to go to Trash to permanently delete the items.

After I click delete once, I want it gone for good! I don’t like that two-step deleting process.

If you want that, too, then read this tutorial to learn how to disable the Trash feature in WordPress.

Disable Trash in WordPress

This will be easy!

All you have to do is to add one line of code into your wp-config.php file.

Step 1

Access your WordPress files and find the wp-config.php file.

It should normally be in your root folder:

public_html/wp-config.php

wp-config.php in cpanel
Editing wp-config.php in cPanel

If you’re using an add-on domain, then it should be in:

public_html/YourDomain/wp-config.php

Step 2

Open the file for editing and add this code:

define( 'EMPTY_TRASH_DAYS', 0 );

Add it right above this line:

/* That's all, stop editing! Happy blogging. */

disable Trash in WordPress

That’s it!

Let’s test it out!

trash disabled in wordpress

As you can see, there’s no Trash link showing at the top after I delete the post.

Also, the red Trash link that normally appears when you hover over a post was replaced by a Delete Permanently link.

So, be careful before deleting because you don’t get another chance!

If you want to play it a bit more safe, then you can just limit the number of days WordPress keeps your items in Trash.

You’ll have to use the same code, but instead of 0 (which stands for 0 days) add another number of days (e.g. 1, 3, 5, etc).

define( 'EMPTY_TRASH_DAYS', 1 );

For example, the above code will keep the items in the WordPress Trash for only one day before it permanently deletes them automatically.

That’s a Wrap

Hope you found the tutorial useful, and you managed to disable the Trash feature in WordPress!

If you need help setting up your WordPress site, my WordPress installation service is at your disposal!

You can quickly subscribe to my newsletter by using this link.

You can also hit the follow button on Twitter and subscribe to the YouTube channel.

If you have any questions or thoughts, drop a comment or send a message via contact or Facebook page.

Don’t forget to share the post to help out others!