If this tutorial is not what you were looking for, you still have any questions, suggestions or concerns - feel free to let us know. Please help us to serve you better!

Your Name

Your Email

Your Message (required)


Featured templates

How to limit or disable automatic empty trash in WordPress

Our support team is ready to present you a new tutorial that shows how to limit or disable the automatic empty trash in WordPress.

When you delete a post or comment in WordPress, it is placed to the trash by default. Trashed posts and comments remain in your database for 30 days. In case it is needed you can restore anything from the trash.

After 30 days, WordPress automatically deletes all trash content permanently.

In this article, we will explain how to limit or disable automatic WordPress empty trash feature.

  1. If you would like WordPress to stop deleting the items from trash automatically, open file functions.php located in the theme folder. Add the following code to the file:
    function my_remove_schedule_delete() {
        remove_action( 'wp_scheduled_delete', 'wp_scheduled_delete' );
    add_action( 'init', 'my_remove_schedule_delete' );

    Now, when you send an item to the trash, it will remain there until you go to the trash and empty it manually.

  2. WordPress automatically empties trash after 30 days. You can change this to any number of days you want. In order to do so, you need to add the following line to wp-config.php file, located in the root folder of your site:
    define('EMPTY_TRASH_DAYS', 7);

    You can change 7 to any other number of days.

Feel free to visit our blog to check more tips on working with WordPress templates. Stay tuned!