Skip to content

Instantly share code, notes, and snippets.

@reachkamrul
Created February 11, 2022 11:56
Show Gist options
  • Save reachkamrul/ba9ad4fa58bed2929f53991fcaa4039e to your computer and use it in GitHub Desktop.
Save reachkamrul/ba9ad4fa58bed2929f53991fcaa4039e to your computer and use it in GitHub Desktop.
/*
* The following functions will add additional file types option to your file upload element
* In this case, You can enable MSG file format
* Just add this snippet to your theme's functions.php file or relevant place.
*/
add_filter('fluentform_file_type_options', function ($types) {
$types[] = [
'label' => __('MSG file - MSG', 'fluentform'),
'value' => 'msg',
];
return $types;
});
add_filter('upload_mimes', function ($mime_types) {
$mime_types ['msg'] = 'application/vnd.ms-outlook';
return $mime_types;
}, 1, 1);
add_action('fluentform_starting_file_upload', function () {
add_filter('fluentform_uploader_args', function ($args) {
$args['test_type'] = false;
return $args;
});
});
//http req
add_filter('ff_default_file_extensions', function ($mime_types) {
$newTypes = [
'application/vnd.ms-outlook' => 'msg',
];
$mime_types = array_merge($mime_types, $newTypes);
return $mime_types;
}, 1, 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment