How to upload all media to one folder, with no year/month subfolders

Pop this tiny code snippet into a file located here:
wp-content/mu-plugins/upload-dir.php (a must use plugin file).
Create the mu-plugins directory if it does not exist already.

<?php
add_filter( 'pre_option_uploads_use_yearmonth_folders', '__return_zero');

What you’re doing here is filtering an option value at runtime, which is picked up internally by _wp_upload_dir() and therefore uploads are no longer nested into date-based subdirectories.

tech