Skip to content

Instantly share code, notes, and snippets.

@mingomax
Created June 10, 2013 19:07
Show Gist options
  • Save mingomax/5751331 to your computer and use it in GitHub Desktop.
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
<?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