Descripción
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.
Changelog v. 3.4.6 (2020-07-17)
- fixed a null dereference error. (thanks, defotoverij!)
Changelog v. 3.4.5 (2020-05-05)
- added french translation (thanks, bibi699depreau!)
Changelog v. 3.4.4 (2019-03-24)
- Fixed a few PHP warnings
- Removed the %permalink% template as it broke uploads to drafts.
Changelog v. 3.4.3.2 (2019-03-24)
- Added support for the Gutenberg editor.
Changelog v. 3.4.2 (2015-03-16)
- Added filter ‘cud_generate_path’ so you can easily adjust the path with any variable you want.
- Added %mime_type% to sort files by mime type
- Added %author_role% to sort files by author role.
- 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)
- Added %file_ext% to sort by file type
- Added tentative support for uploads from WordPress apps.
- Removed setting for “Base upload folder” as WP core no longer exposes this
- Cleared out some PHP error on the admin page
- Fixed leaking CSS on admin page
Changelog v. 3.3 (2011-12-18)
- Support for WordPress 3.3
- Support for tags and categories
- Support for custom taxonomies
- Added %current_user%, %permalink%
- Added all permalink tags
- Added test-function to admin page
Additional Info
Copyright (C) 2007-2019 Ulf Benjaminsson
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
Capturas
Instalación
- Extract the
custom-upload-dir
-folder and transfer it to the/wp-content/plugins/
directory - Activate the plugin through the ‘Plugins’ menu in WordPress
- Customize your directory structure in
Settings -> Custom Upload Dir
Preguntas frecuentes
-
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.
-
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');
Reseñas
Colaboradores y desarrolladores
Este software es de código abierto. Las siguientes personas han contribuido a este plugin.
ColaboradoresTraduce “Custom Upload Dir” a tu idioma.
¿Interesado en el desarrollo?
Revisa el código, echa un vistazo al repositorio SVN o suscríbete al registro de desarrollo por RSS.
Registro de cambios
Changelog v. 3.4.5 (2020-05-05)
- added french translation (thanks, bibi699depreau!)
Changelog v. 3.4.4 (2019-03-24)
- Fixed a few PHP warnings
- Removed the %permalink% template as it broke uploads to drafts.
Changelog v. 3.4.3.2 (2019-03-24)
- Fixed ‘upload_dir’ not providing $post_id in Gutenberg editor.
Changelog v. 3.4.1 (2015-03-16)
- Added filter ‘cud_generate_path’ so you can easily adjust the path with any variable you want.
- Added %mime_type% to sort files by mime type
- Added %author_role% to sort files by author role.
- 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)
- Added %file_ext% to sort by file type
- Added tentative support for uploads from WordPress apps.
- Removed setting for “Base upload folder” as WP core no longer exposes this
- Cleared out some PHP error on the admin page
- Fixed leaking CSS on admin page
Changelog v. 3.3.2 (2011-12-29)
- Updated init to use WordPress API properly
- Removed dead code
Changelog v. 3.3.1 (2011-12-27)
- Fixed poor sanitization of post slugs (%post_name%)
- Added %post_parent%
- Fixed settings not always initializing
Changelog v. 3.3 (2011-12-18)
- Support for WordPress 3.3
- Support for tags and categories
- Support for custom taxonomies
- Added %current_user%, %permalink%
- Added all permalink tags
- Added test-function to admin page
Changelog v. 3.0.2 (2011-07-29)
- Fix for post_author not working
- Fix timestamps from the media uploader (thanks; alx359)
Changelog v. 3.0.1 (2010-11-01)
- Fix for “undefined function get_userdata()” (thanks somatic!)
Changelog v. 3.0 (2010-10-21)
- Rewrote entire plugin for WordPress 3.0
- A slew of new placeholders for building path’s with
- A new interface to allow arbitrary strings in path
- Error messages when uploading to un-named or un-dated posts
- Added translation support
Changelog v.2.5.4 (2008-12-31)
- 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.
- 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)
- Fixed problem with plugin blocking deletion/editing of attached files.
Changes in v.2.5.1 (2008-12-14)
- Fixed Custom Upload Dir breaking WP 2.7 when called from the loop
Changes in v.2.5 (2008-11-15)
- Support for WP 2.7-beta1
- Added ‘post_author’
- Fixed ‘post_title’ (broken since WP 2.4)
- Fixed issue with use_yearmonth overriding post date
- Tons of small(ish) updates
- Removed Mediacaster-support
Changes in v.2.0 (2007-10-19)
- Mediacaster compability.
- Added proper configuration screen
- Massive code overhaul
- Name change (previously “Daily Upload Dir”)