WordPress upload bestandstype niet toegestaan
Oplossen met WP config bestand
Voeg de volgende regel toe in de wp-config.php:
define(‘ALLOW_UNFILTERED_UPLOADS’, true);
Oplossen met custom plugin
Als je daar niet voor kiest, kun je de plugin Disable Real MIME Check installeren.
Oplossen met functions.php bestand
Een derde oplosmogelijkheid is de functions.php van het theme aan te passen. Ieder thema bevat een functions.php bestand en zal je het dus vinden in de map van je thema. Vaak zit dat in één van de onderstaande locaties:
public_html/wp-content/themes/jouwthemanaam/functions.php
custompadhier/wp-content/themes/jouwthemanaam/functions.php
add_filter(‘upload_mimes’, ‘custom_upload_mimes’);
function custom_upload_mimes ($existing_mimes = array()) {
$mimetype = new mimetype();
$file_types = get_option(‘ext’);
$variables = explode(‘ ‘, $file_types);
foreach($variables as $value) {
$value = trim($value);
if(!strstr($value, ‘/’)) {
$mime = $mimetype->privFindType($value);
} else {
$mime = $value;
}
$existing_mimes[$value] = $mime;
}
return $existing_mimes;
}
class mimetype {
function privFindType($ext) {
$mimetypes = $this->privBuildMimeArray();
if (isset($mimetypes[$ext])) {
return $mimetypes[$ext];
} else {
return ‘application/octet-stream’;
}
}
function privBuildMimeArray() {
require_once(‘inc/types-mimes.php’);
return $types;
}
}