Custom file type support for File Uploader

Is it possible to add a .json file type support to the MainWP File Upload Extension? It would be awesome to upload .json files (Elementor Pre-designed Templates) to my sites straight into the Elementor template folder…instant ready to use for the clients without any hassle.

Hey @maxim, the MainWP File Uploader Extension provide the mainwp_file_uploader_allowed_file_types filter that you can use to add more file types to the array. For example, to add .json, you can use the following snippet

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;
}

You can use the free MainWP Custom Dashboard Extension to apply this snippet.

6 Likes

Perfect! Thanks for the solution!

1 Like

Can we have this added to the Code Snippets category?

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.