Created
June 10, 2013 19:07
-
-
Save mingomax/5751331 to your computer and use it in GitHub Desktop.
This snippet show a filter to add or change the upload dir for a CPT
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 | |
function post_type_dir( $param ){ | |
$screen = get_current_screen(); | |
$mydir = '/'.$screen->post_type; | |
$param['path'] = $param['path'] . $mydir; | |
$param['url'] = $param['url'] . $mydir; | |
return $param; | |
} | |
//FILTERS | |
add_filter('upload_dir', 'post_type_dir'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment