in WordPress by (16.3k points)
0 like 0 dislike
3.7k views

There are many directories under "wp-content/uploads" and most of them are empty because WordPress automatically creates these directories for every year and month, whether they are needed or not. Why does WP create these empty directories?

How can I turn off to create folders for every years and months in uploads WordPress folder? How can I disable regular automatic directory creation for each year and month in uploads directory in WordPress CMS?

Suitable search queries for this question
  • wordpress disable to create directory in uploads
  • wordpress disable to create folders for every years and months in uploads folder

1 Answer

0 like 0 dislike
by (16.3k points)

You can turn it off in following way: Admin panel → Left menu → "Settings" item → "Media" item → "Media settings" page → "Uploading files" heading → uncheck box "Organize my uploads into month- and year-based folders" → click "Save Changes" button.

When you uncheck this box, all future media uploads will be made directly to "wp-content/uploads" directory without automatically creating child directories for each year and month, incl. empty.

The reason for creating these empty directories is a small bug in WordPress code that prepares a directory where it can upload files via an API that is not always used as part of upload process. Aside from being an eyesore, these empty directories have no effect on site size, performance, or anything else.

What is the reason for this? By itself, WordPress does not just create these directories, they are only created during the process or attempt to upload files. Who does it? If the site users themselves do not do this, then some bots do it. For example, spam bots can automatically constantly make attempts to upload any files to the site through the corresponding CMS API. That's why CMS creates these empty directories for each year and month on the server on the 1st upload attempt in each new month of each year.

Please log in or register to answer this question.