WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am reading the documentation of WordPress Media Library and it seems to me that it doesn't allow me to split my uploaded media into directories. Is it true? Why this choice?

How can I implement that?

share|improve this question

From your question what i understood is u need to store media files to another custom location. if that is your doubt then this may help you..

In order to change the default media upload location, you need to edit the wp-config.php file. If you want upload directory to be wp-content/example then you will need to place the following code in wp-config.php

define( 'UPLOADS', 'wp-content/'.'example' );

If you want the upload directory to be outside wp-content, like http://www.example.com/example/ then give it like this

define( 'UPLOADS', ''.'files' );

or you can try media file manager plugin to manage the media folders from the admin dashboard itself.


Function to create a sub-directory inside the upload directory for every upload is :

function kv_custom_image_dir( $pathdata ) {
$subdir = '/uploads_img'.$pathdata['subdir'];
$pathdata['path'] = str_replace($pathdata['subdir'], $subdir,    $pathdata['path']);
$pathdata['url'] = str_replace($pathdata['subdir'], $subdir, $pathdata['url']);
$pathdata['subdir'] = str_replace($pathdata['subdir'], $subdir, $pathdata['subdir']);
return $pathdata;
 }add_filter( 'upload_dir', 'kv_custom_image_dir' );

if you want to read more check this blog

share|improve this answer
now...I need have the possibility to create subdirectory into my standard media directory, for example: "logos", "brochures", "articlesImmages",etcetc – AndreaNobili Jul 17 '14 at 12:01
ok..so u need to create folders inside wp-content/uploads similar to the default month folder right?? – USER5615 Jul 17 '14 at 12:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.