brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: the WordPress setting for month and year upload folders only affects new files

WordPress
~/tips/tip-wordpress-uploads-month-year-folders

wp option get uploads_use_yearmonth_folders

Explains the Settings > Media checkbox that sorts uploads into dated folders.

Under Settings > Media there is one checkbox I’d look at on a new site: “Organize my uploads into month- and year-based folders”.

When it is on, which is the default, an image uploaded in November 2026 goes to wp-content/uploads/2026/11/. When it is off, every file lands directly in uploads. The same option can be read or set from the command line:

wp option get uploads_use_yearmonth_folders
wp option update uploads_use_yearmonth_folders 0

I’d leave it on. Thousands of files in one folder are slow to browse over FTP or SFTP, and file name clashes become more likely, so WordPress has to add -1, -2 to names more often. Dated folders also make it easy to back up or check one month.

The folder is decided at the moment of upload, and the path is stored with the attachment. Changing the setting does not move anything. Old files stay where they are and keep working, new files go to the new place. So you end up with a mix, which is fine for WordPress but can surprise you when you look at the server.

Moving existing files yourself breaks every image on the site, because posts and attachment data still point to the old paths.

Further reading: Settings Media screen, wp_upload_dir()

More WordPress tips wp user application-password create anna backup-script --porcelain define( 'MEDIA_TRASH', true ); wp cli check-update wp theme delete --all wp media image-size All WordPress tips (85) All topics

Link