几年前我也写过,让Wordpress支持torrent格式。

但是现在wp5系列安全性提高了,按照以前的方式修改,没用。

现在要多加代码才行。

之前文章:增加wordpress可以上传.torrent文件

新版本因为安全问题,还要修改主程序的functions.php文件。

一、wp-includes/functions.php

搜索:application/zip

在下面加一行:

‘application/torrent’,

‘application/x-bittorrent’,

搜索:’zip’ => ‘application/zip’,

加一行:

‘torrent’ => ‘application/torrent’,

二、修改主题functions.php

在里面加上:

add_filter('upload_mimes', 'add_new_mimes');
function add_new_mimes($mimes)
{
$mimes['torrent'] = 'application/x-bittorrent';
return $mimes;
}

最后保存,给下权限就行了。