1

Prior to version 3.5 (or thereabouts), WP had a checkbox to select if all uploaded media went into sub-folders of /uploads, named by month and year. If checkbox was unchecked, all media ended up in one folder - no subfolders.

How can I restore that feature? I.e., I want all my media to go into one folder and NOT be further divided into year and month. Is there some easy programmatic way to achieve that? Or is there some reliable plugin to do the job?

Thanks!

1

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.

0

Can you not just un-tick the box in Admin -> Settings -> Media:

Wordpress media settings

  • No because this checkbox was removed after version 3.5 (or 3.4 or 3.6 - can't recall), so the easy obvious fix is no longer available. – user2187609 Nov 4 '17 at 20:27
  • I'm on 4.8.3, but with a custom install. I'll have a check and see how I (accidentally?) enabled this option again. – Alexander Holsgrove Nov 4 '17 at 20:32
  • I just did a fresh install of 4.8.3 and the option in the screenshot I posted is there. – Alexander Holsgrove Nov 4 '17 at 21:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.