Add Support for a Custom File Type in File Uploader

By default, the MainWP File Uploader Extension doesn't support all file types. By using the mainwp_file_uploader_allowed_file_types filter, it is possible to add support for any file type. In this example, we will show how to add support for the JSON file type:
  1. Install and activate the MainWP Custom Dashboard extension
  2. Go to the PHP section (MainWP > Extensions > Custom Dashboard > PHP)
  3. Paste the following code snippet and Save Chagnes:
add_filter('mainwp_file_uploader_allowed_file_types', 'mycustom_mainwp_file_uploader_allowed_file_types');
function mycustom_mainwp_file_uploader_allowed_file_types( $types ) {
   $types[] = 'json';
   return $types;
}
 

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.