This plugin hasn’t been tested with the latest 3 major releases of WordPress. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

Custom Upload Dir

Description

WordPress allow you to put uploads in year- and month-based folders. Custom Upload Dir is more flexible. You can construct paths from variables like post title,
category, post author, post date and many more.

I created Custom Upload Dir ensure my file system is always mirroring the site structure. This ensures I can always find files manually when needed. It also simplifies backups and platform migrations.

The screenshots might help explain.

If you value my plugins, there’s several ways you can help me out;

Any help is greatly appreciated. Thanks!

//Ulf Benjaminsson

Changelog v. 3.4.2 (2015-03-16)

  1. Added filter ‘cud_generate_path’ so you can easily adjust the path with any variable you want.
  2. Added %mime_type% to sort files by mime type
  3. Added %author_role% to sort files by author role.
  4. Coming: support for per-post-type settings. Eg: every post type can have their own rules for where to place uploads. Currently missing the admin interface. If you feel like helping out, let me know.

Changelog v. 3.4 (2013-02-09)

  1. Added %file_ext% to sort by file type
  2. Added tentative support for uploads from WordPress apps.
  3. Removed setting for “Base upload folder” as WP core no longer exposes this
  4. Cleared out some PHP error on the admin page
  5. Fixed leaking CSS on admin page

Changelog v. 3.3 (2011-12-18)

  1. Support for WordPress 3.3
  2. Support for tags and categories
  3. Support for custom taxonomies
  4. Added %current_user%, %permalink%
  5. Added all permalink tags
  6. Added test-function to admin page

Older changelogs moved here.
Copyright (C) 2007-2015 Ulf Benjaminsson (my first name at ulfben dot com).

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Screenshots

  • The configuration screen.
  • Shows how the upload path corresponds to the post's timestamp.

Installation

  1. Extract the custom-upload-dir-folder and transfer it to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress.
  3. Customize your directory structure in Settings -> Custom Upload Dir

FAQ

Installation Instructions
  1. Extract the custom-upload-dir-folder and transfer it to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress.
  3. Customize your directory structure in Settings -> Custom Upload Dir
How do I change base upload folder?

Since WP 3.5, by a setting in wp-config.php:

define('UPLOADS', WP_CONTENT_DIR.'/your-folder');

Just be aware that this will likely break all paths to your previously uploaded stuff.

How can I define my own tags?

Use the cud_generate_path-filter, like so:

function my_generate_path($template, $post_id){
    $my_tags = array('%tag1%','%tag2%');
    $replace = array($data, getData());
    $customdir = str_replace($tags, $replace, $template);
    return $customdir;
}
add_filter('cud_generate_path', 'my_generate_path');

Reviews

Very useful in some cases

This is a great plugin which can be very useful for those with large media libraries. It helps to sort the uploads into multiple, manageable folders with a logical and intuitive directory structure.

If your site will have a large media library, the normal year/month folders created during your main site build-out period can become huge – and therefore very hard to back up. This plugin solves that problem.

If you have a site in which you will often go back and edit posts and pages and CPTs, you’ll find that standard WP folder structures are misleading: media that you add to a post a year later will not be put in the folder that corresponds to the current year/month, but rather in the dated folder of when the post was originally created. It can be very hard to find files. This plugin solves that problem; you’ll never have trouble finding a file again.

The plugin has a few quirks and shortcomings:

You must always name and publish your post/page/CPT before you can upload files to it. This can be an issue until you get into that habit, but once you do it is not a big issue.

%permalink% should not be one of the options that you can choose to use in your path structure, in my opinion. Using it breaks the WP default Draft functionality. (So I just don’t use it which avoids the issue. This may be fixed in future releases.)

Documentation could be better; but it is a free plugin, after all!

Plugin author is not great at updating the plugin – but that never effects the functionality. Again, give the guy a break, it’s a free plugin.

So yes, a few quirks and minor shortcomings, but overall a terrific plugin.

Just awesome!

This plugin is simple, right to the point, and does the job perfectly. I can’t wait for this coming feature: Support for per-post-type settings. This will save my life!

Works fine

You want the tree structure of your “uploads” folder matches the structure of your site.
You want to find easily medias with your FTP client.
You want to overcome the limits imposed by your host in the uploads folder. Shared hosting limit the number of visible files with an FTP client, for example 4998 files or less, and it goes fast with the file size variations.
Fortunately, Custom Upload Dir is there. Thank you to the author.
The plugin works fine with WordPress 4.5.

Patrick

Works great

The plugin does what it says.
It’s a relieve to have this plugin.

Imho WP still lacks a decent media upload manager, even in 2016 it seems that emoticons and other useless stuff is more important.

Unhelpful Developer

My review is on the developer and not the plugin. The plugin does work, but the instructions are not written for the novice and when posting questions on how to use it, the developer is of no help and very rude. So as long as you are not novice and can understand the brief instructions, the plugin works fine, but if you need help, look elsewhere for it as you won’t get it from the developer.

Read all 18 reviews

Contributors & Developers

“Custom Upload Dir” is open source software. The following people have contributed to this plugin.

Contributors

Translate “Custom Upload Dir” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

Changelog v. 3.4.1 (2015-03-16)

  1. Added filter ‘cud_generate_path’ so you can easily adjust the path with any variable you want.
  2. Added %mime_type% to sort files by mime type
  3. Added %author_role% to sort files by author role.
  4. Coming: support for per-post-type settings. Eg: every post type can have their own rules for where to place uploads. Currently missing the admin interface. If you feel like helping out, let me know.

Changelog v. 3.4 (2013-02-09)

  1. Added %file_ext% to sort by file type
  2. Added tentative support for uploads from WordPress apps.
  3. Removed setting for “Base upload folder” as WP core no longer exposes this
  4. Cleared out some PHP error on the admin page
  5. Fixed leaking CSS on admin page

Changelog v. 3.3.2 (2011-12-29)

  1. Updated init to use WordPress API properly
  2. Removed dead code

Changelog v. 3.3.1 (2011-12-27)

  1. Fixed poor sanitization of post slugs (%post_name%)
  2. Added %post_parent%
  3. Fixed settings not always initializing

Changelog v. 3.3 (2011-12-18)

  1. Support for WordPress 3.3
  2. Support for tags and categories
  3. Support for custom taxonomies
  4. Added %current_user%, %permalink%
  5. Added all permalink tags
  6. Added test-function to admin page

Changelog v. 3.0.2 (2011-07-29)

  1. Fix for post_author not working
  2. Fix timestamps from the media uploader (thanks; alx359)

Changelog v. 3.0.1 (2010-11-01)

  1. Fix for “undefined function get_userdata()” (thanks somatic!)

Changelog v. 3.0 (2010-10-21)

  1. Rewrote entire plugin for WordPress 3.0
  2. A slew of new placeholders for building path’s with
  3. A new interface to allow arbitrary strings in path
  4. Error messages when uploading to un-named or un-dated posts
  5. Added translation support

Changelog v.2.5.4 (2008-12-31)

  1. Adjusted the test case. (Pedja)

Changelog v.2.5.3 (2008-12-30)

More problems have crept up due to the massive amount of dry runs of ‘upload_dir’ in WP 2.7.

  1. Added quick bail for every call that’s not for a file upload. (props to Pedja Ljubomirovic (Canada))

Changelog v.2.5.2 (2008-12-15)

  1. Fixed problem with plugin blocking deletion/editing of attached files.

Changes in v.2.5.1 (2008-12-14)

  1. Fixed Custom Upload Dir breaking WP 2.7 when called from the loop

Changes in v.2.5 (2008-11-15)

  1. Support for WP 2.7-beta1
  2. Added ‘post_author’
  3. Fixed ‘post_title’ (broken since WP 2.4)
  4. Fixed issue with use_yearmonth overriding post date
  5. Tons of small(ish) updates
  6. Removed Mediacaster-support

Changes in v.2.0 (2007-10-19)

  1. Mediacaster compability.
  2. Added proper configuration screen
  3. Massive code overhaul
  4. Name change (previously “Daily Upload Dir”)