Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

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.

Edit:

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 at 12:01
    
ok..so u need to create folders inside wp-content/uploads similar to the default month folder right?? –  Ammu Jul 17 at 12:12

Your Answer

 
discard

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.