Using Add from Server to upload by post ID
You can try to add this into your functions.php file: add_filter( ‘upload_dir’,’wpse87234_upload_dir’); function wpse87234_upload_dir($uploads){ // check if we are in the “Add From Server” media tab if (isset($_REQUEST[‘post_id’]) && isset($_GET[‘tab’]) && $_GET[‘tab’]==”server”) { $prefix=”post_”; $post_id=(int)$_REQUEST[‘post_id’]; // change the uploads info to our needs: $uploads[‘subdir’]=”https://wordpress.stackexchange.com/”.$prefix.$post_id; $uploads[‘path’]=$uploads[‘basedir’].$uploads[‘subdir’]; $uploads[‘url’]=$uploads[‘baseurl’].$uploads[‘subdir’]; } return $uploads; } This should give directory like … Read more