Software Development

XML uploads in WordPress

By default the WordPress media uploader does not permit the uploading of XML files, but this is easily modified.

add_filter('upload_mimes', 'custom_upload_xml');

function custom_upload_xml($mimes) {
    $mimes = array_merge($mimes, array('xml' => 'application/xml'));
    return $mimes;
}

Add this in your themes functions.php file or in a plugin. The function name [custom_upload_xml] can be changed, but just make it consistent. The same technique can be used to allow other file types to be uploaded.

Standard