Change or deactivate WordPress's automatic empty trash
Nov 17, 2019
You aren't using the Trash feature in WordPress? No problem! Add this line in your wp-config.php
at the root of your WordPress installation to disable the feature altogether.
define('EMPTY_TRASH_DAYS', 0); // The 0 here is the number of days for WordPress to keep a trashed item before deleting it.
No need to use a plugin for this, but if you ever find yourself in a situation where you have to: Change Empty Trash Time.
By default, WordPress automatically deletes post in your trash after 30 days. If you'd like to keep using the trash but want to disable the automatic deletion, add this hook in your theme's function.php
(child theme is recommended!):
function remove_scheduled_delete() {remove_action('wp_scheduled_delete', 'wp_scheduled_delete');}add_action('init', 'remove_scheduled_delete');
Published on November 17, 2019
Written by Vladislav Kim