I have a client who wants to use the trash feature, but keep items in there indefinitely (I have no idea why, but they insist on it).
From reading this codex article on the trash status, I see that you can set the EMPTY_TRASH_DAYS constant to zero. But it says that this will disable trash functionality altogether. I don’t want to do this. I just want to disable the auto-trash emptying.
Is there any way to do this? Or am I stuck with just entering some huge number for the EMPTY_TRASH_DAYS value?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
My guess is – yes, you are stuck with exactly that.
Checks for EMPTY_TRASH_DAYS seem to be hardcoded as condition for switching interface between trash and delete in several places.
Method 2
You can do the following:
-
Set
EMPTY_TRASH_DAYSto a very high number. E.g.:define( 'EMPTY_TRASH_DAYS', 1000000 ); -
Or remove the
wp_schedule_deleteaction:function my_remove_schedule_delete() { remove_action( 'wp_scheduled_delete', 'wp_scheduled_delete' ); } add_action( 'init', 'my_remove_schedule_delete' );
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0