I am creating one plugin and it’s for contact forms and they have file field i am save that file in custom folder and for that i am using function named “aaiof_upload_dir” but in debug.log it’s says function not found.my code is metion below.
add_filter('upload_dir', 'aaiof_upload_dir'); //define function of aaior_upload_dir
$movefile = wp_handle_upload( $uploadedfile, $upload_overrides ); //using for upload file in default uploads folder
remove_filter(‘upload_dir’, ‘aaiof_upload_dir’);
`
if (!function_exists( 'aaiof_upload_dir')){
function aaiof_upload_dir($upload) {
$upload['subdir'] = '/contact_form';
$upload['path'] = $upload['basedir'] . $upload['subdir'];
$upload['url'] = $upload['baseurl'] . $upload['subdir'];
return $upload;
}
}