How to Upload JSON to WordPress

For security reasons, WordPress only allows certain file types to be uploaded through the WordPress Admin Dashboard by default. We’ll go over what MIME file types are, which ones WordPress doesn’t restrict, and a few ways to remove the restriction and enable the uploading of JSON files (and any additional types).

Table of Contents

  1. About MIME File Types and WordPress
  2. Ways to Upload JSON to WordPress
    1. Use a Plugin
    2. Edit the functions.php (or custom plugin)
    3. Edit the wp-config.php
  3. Summary

What are MIME File Types?

A Multipurpose Internet Mail Extensions type is a standard way of data type classification used with web technology, such as browsers, to determine how the file will be handled.

A MIME type is made of two parts – a type and subtype, separated by a ‘/’. Some common MIME types are ‘application/json’ , ‘image/png’, and ‘text/html’.

A use-case example is how the browser would determine by a .png file’s MIME type that it must be handled as an image file type, and not as any other file type, such as audio or video.

MIME File Types WordPress Allows by Default


  • .mp3
  • .m4a
  • .ogg
  • .wa


  • .pdf
  • .doc, .docx
  • .ppt, .pptx, .pps, .ppsx
  • .odt
  • .xls, .xlsx
  • .psd


  • .jpg
  • .jpeg
  • .png
  • .gif
  • .ico


  • .mp4
  • .m4v
  • .mov
  • .wmv
  • .avi
  • .mpg
  • .ogv
  • .3gp
  • .3g2

Ways to Upload JSON to WordPress

Below are a few different ways we can tell WordPress to allow JSON uploads:

Allow JSON File Uploads via a Plugin

This is the most straight-forward approach, especially if you don’t want to edit any code.
Here are some recommended plugins that are free and simple to use:

WP Add Mime Types

  1. After downloading the plugin, go to Settings -> MIME Type Settings
  2. In the “Add Values” settings, add: json = application/json
  3. Click the “Save” button
  4. Check that it has been added to the “List of allowed mime types and file extensions by WordPress
Screenshot of WordPress plugin showing "Add Values" settings
Screenshot of WordPress plugin showing Mime Types settings

WP Extra File Types Plugin

WP Media File Type Manager

Edit functions.php or custom plugin file

Using the upload_mimes filter will change the default MIME types list allowed by adding each of your desired file types to it.
In your theme’s function.php file (or custom plugin file), add the following code (lines 7-11):

Note: Usually the MIME type for JSON used here would be ”application/json, but because of a current WordPress core bug it’s being interpreted as ‘text/plain’. Therefore, in the code above we use ‘text/plain’.

Edit wp-config.php

WordPress has an ALLOW_UNFILTERED_UPLOADS option that can be enabled in the wp-config.php file. This will allow ALL file types to be uploaded by administrator level users, so it may be a bit overkill to enable it if you want just one specific file type enabled.
In the wp-config.php file, add the following code:



MIME type files have the purpose of giving the browser data information so that it knows what to do with media files. WordPress, by default, allows a limited type of files that can be uploaded and that does not include JSON. To set WordPress to accept JSON files for uploading you can either: use a plugin to change the settings, or edit/add code to the functions.php or wp-config.php files.

Hope this article was helpful to you! 😉

Molly smiling

Molly Chanel Creative Software Engineer / Web Developer

Hey there, thanks for viewing my website! Here's a bit about me:
I enjoy learning; it enables me to grow and better help out. I have fun building things that look and feel great (and work!). On the side:
Anime & shows distract me, fitness goals abound, and music resonates.

May we learn and contribute, together! 🤓 💛

More About Me Contact

Leave a Reply

More Posts