How to allow import .json type file

Hello. I had a problem with Import Layers Style Kit Preset .Json file. I had message like “Sorry, This File Type Is Not Permitted For Security Reasons.”
On Layers documentation I read about fixing this problem - they ask to download WPMU plugin and get permission for json files. But I can't find this option on my profile. Can you help me with that? Is it right place to do that? I'm new on your platform. Thank you.

  • Rupok
    • Support Ninja

    Hi John,

    Thanks for asking. For allowing JSON files to be uploaded on your site, at first you will have to create a MU Plugin. For creating a MU Plugin, create a folder named "mu-plugins" inside your "wp-content" folder. Then inside that "mu-plugins" folder, create a file with any name and with a .php extension. Now paste the code inside that file and save.

    <?php
    function custom_myme_types($mime_types){
      $mime_types['json'] = 'application/json';
      return $mime_types;
    }
    add_filter('upload_mimes', 'custom_myme_types', 1, 1);

    For getting more idea on mu plugins, you can go through this article: http://premium.wpmudev.org/manuals/wpmu-manual-2/using-mu-plugins/

    After this, please open your "wp-config.php" file from the root directory of your domain in the server and add the following line in that file:
    define( 'ALLOW_UNFILTERED_UPLOADS', true );
    Save that file and exit.

    After these, you should be able to upload JSON files on your site.

    I believe, this will help. Please let us know if you have any confusion or any further query. We will be glad to help.

    Have a nice day. Cheers!
    Rupok

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.