Allow to upload XML files in WordPress
Quote from HeelpBook on July 29, 2020, 5:35 pmHow to enable in Wordpress the upload of .xml files? I need that as I'm publishing some on my website...
How to enable in Wordpress the upload of .xml files? I need that as I'm publishing some on my website...
Quote from HeelpBook on July 29, 2020, 5:40 pmFor security reasons, WordPress does not allow to upload XML files into the media library, by default.
To alleviate this limitation, you have to add the following PHP code to functions.php in your current theme.
add_filter('upload_mimes', 'custom_upload_xml');
function custom_upload_xml($mimes) {
$mimes = array_merge($mimes, array('xml' => 'text/xml'));
return $mimes;
}The path to this file is [WORDPRESS_ROOT]/wp-content/themes/[MY_THEME]/functions.php.
For security reasons, WordPress does not allow to upload XML files into the media library, by default.
To alleviate this limitation, you have to add the following PHP code to functions.php in your current theme.
add_filter('upload_mimes', 'custom_upload_xml'); function custom_upload_xml($mimes) { $mimes = array_merge($mimes, array('xml' => 'text/xml')); return $mimes; } |
The path to this file is [WORDPRESS_ROOT]/wp-content/themes/[MY_THEME]/functions.php.