Custom Upload Directory

By default, WordPress uses the same uploads folder for every uploaded media, no matter who uploads it, where they upload it from or the type of media it is.  This can cause problems for larger sites with lots of uploaded media, especially when many image sizes are created by WordPress.  It can not only be a headache to go through manually, it can actually slow down your site (if those folders have thousands of images each).

But, its really not too hard to better organize those uploads into folders that you control, based on the above criteria.  I use it to keep media associated with my portfolio page better organized.

This example has set a folder for each Custom Post Type.  With some simple tweaking, this can also be used for usernames, multisites, media type, post category or anything else you can think of.

Place the following in functions.php or create a plugin.

Dave Winter focuses in WordPress UI Design and WordPress Plugin Development (some have labelled him a fanatic) but has hands in many other projects, including photography and music. He's never far from a computer... or an iPad (for testing purposes, of course). If you've been to a WordCamp in Southern California, he probably already knows who you are (or maybe not - he's terrible with names). Dave currently teaches courses at California State University, Long Beach alongside his small business at (and his students think he's pretty boss).
© 2008-2020,