25% off ProSNIPC25OFF

Change Trash Auto-Empty Days

Overrides the number of days WordPress waits before permanently deleting trashed posts (default is 30 days).

PHPby SnipCraft
php
<?php
// Filter the stored option so the value takes effect for the trash cron job.
// Change 7 to however many days you want trashed items to survive.
add_filter( 'option_empty_trash_days', 'scseed_change_trash_days' );
if ( ! function_exists( 'scseed_change_trash_days' ) ) {
    function scseed_change_trash_days() {
        return 7; // Days before permanent deletion; set 0 to disable trash entirely.
    }
}
#admin#cleanup#maintenance#performance