I wanted to expand the type of files that wordpress would allow me to upload and attach to a post. I used a plugin called pjw-mime-config here are a few things that I figured out beyond just using this plugin to add mime types.
I originally wanted to upload and attach a powershell script to a post when wordpress responded with the following error: File type does not meet security guidelines. Try another. I googled the error and found that I needed to add additional mime types to be accepted by wordpress, pjw-mime-config was suggested to easily add mime types, I installed the plugin and fat fingered the mime type, I tried to remove the mime type but it failed to delete it… I uninstalled the plugin and reinstalled thinking that would remove the mime type, no luck. My thought at this point was that the mime types must be stored in the wordpress database by the pjw-mime-config plugin, I worked with a test wordpress installation and exported the DB (db1.sql) installed jpw-mime-config, added a mime type (foo, text/plain) and exported the DB again (db2.sql) I then did a diff on the two SQL exports. Sure enough there jpw-mime-config row in the wordpress DB table wp_options, I uninstalled jpw-mime-config, deleted the row and reinstalled jpw-mine-config and all was good.
After installing jpw-mime-config the wordpress uploader accepted the file but gave an error from the upload dialog that referenced functions.php @ line 2258. To resolve the error I edited ./wp-includes/functions.php and added the ps1 mime type to the get_allowed_mime_types function (starts at appox line 2275).
Great article, but what is the MIME Type for powershell?
Thanks