Disable Organize My Uploads In WordPress Programmically

By default, WordPress uploads media files into folders organized by month and year.  You can disable this by visiting Settings > Media and unchecking this option.   If you would prefer to disable it within your child or custom theme, add the following code to functions.php.  The biggest benefit to storing all your media files in one location is that it is easier to locate a specific file or extremely large files quickly.  If you aren’t sure where a file is located, you could be scouring dozens (if not more) directories just to find one file.

// Prevent default media uploads by year/month
update_option('uploads_use_yearmonth_folders', 0);

If you’d like to define a custom upload folder for your media files, you would add the following line to your wp-config.php file.  You will need to create the folder manually either through FTP or Cpanel’s File Manager.

/** Change Media Upload Directory */
define('UPLOADS', 'wp-media');