Created
July 4, 2014 02:48
-
-
Save vinacode/92d882623de8ebf09c38 to your computer and use it in GitHub Desktop.
Wordpress customize upload media directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/**================Customize upload dir url===================**/ | |
function my_custom_medias_dir( $pathdata ) { | |
$subdir = '/medias'.$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' , 'my_custom_medias_dir'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment