Description

Filter the directory that VFB file uploads are placed in.


This filter is called by the upload_dir filter within VFB Pro and does not affect other uploads within your site.


By default, uploads are placed in /wp-content/uploads/vfb/{year}/{month}

 

Parameters

$upload

(array) (required) The array of upload details to return


$form_id

(int) (optional) The form ID

Default: the form ID


Examples

Set all uploads to go into a custom folder:

 

add_filter( 'vfbp_upload_directory', 'vfbp_filter_upload_directory', 10, 2 );
 
function vfbp_filter_upload_directory( $upload, $form_id ){    
	$dir = 'my-awesome-directory';

	$upload['subdir'] = "/$dir" . $upload['subdir'];
	$upload['path']    = $upload['basedir'] . $upload['subdir'];
	$upload['url']       = $upload['baseurl'] . $upload['subdir'];
	
	return $upload;
}