How to automatically empty the trash bin in WordPress

The WordPress trash bin is automatically emptied every 30 days by default. To run this task more or less frequently, you can define a constant in wp-config.php.
define( 'EMPTY_TRASH_DAYS', 7 ); // Empty every 7 days

You can also disable trash completely by setting the constant to 0.

define( 'EMPTY_TRASH_DAYS', 0 );