S
S
Spark1082015-11-16 16:11:53
Zip
Spark108, 2015-11-16 16:11:53

How to allow zip file uploads in wordpress?

I recently needed to upload an archive with a php script to a wordpress site, but I ran into this problem: WordPress does not allow zip files and most others.
How to fix this ?, what needs to be unearthed in functions.php or added.
I find on the Internet that I need to add some code to the functions.php of the theme, but firstly, if I change the theme, this code also works, thirdly, this code does not work at all, I even put it in the functiions.php of the engine itself, But there already writes that there is no such function, and so on.
Help!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Chesnokov, 2015-11-17
@cesnokov

In general, .ZIP downloads are allowed by default:
https://codex.wordpress.org/Function_Reference/get...
And if you need code, then add this to the theme's "functions.php":

function custom_mime_types($mimes) {
   $mimes['zip'] = 'application/zip';
   return $mimes;
}
add_filter('upload_mimes', 'custom_mime_types');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question