WordPress 无法上传exe附件的问题解决办法

刚写文章放一个exe附件, 提示不能上传此类型文件.
抱歉,出于安全的考虑,不支持此文件类型。
又是哪招, 只能又拜托Google大神了, 办法如下.
我的WordPress是4.31, 按理其他的也差不多同样办法.
ssh服务器, 切换到WordPress安装目录, 然后到wp-inludes目录, 用vi打开functions.php配置文件.

$: vi functions.php 

输入:, 然后敲入2290, 切换到这一行.

/**
* Retrieve list of allowed mime types and file extensions.
*
* @since 2.8.6
*
* @param int|WP_User $user Optional. User to check. Defaults to current user.
* @return array Array of mime types keyed by the file extension regex corresponding
* to those types.
*/
function get_allowed_mime_types( $user = null ) {
$t = wp_get_mime_types();

unset( $t[‘swf’] );
if ( function_exists( ‘current_user_can’ ) )
$unfiltered = $user ? user_can( $user, ‘unfiltered_html’ ) : current_user_can( ‘unfiltered_html’ );
if ( empty( $unfiltered ) )
unset( $t[‘htm|html’] );
把里面的exe这一栏删掉如上面样子, 保存文件, 再打开编辑页面就可以上传exe附件.

Leave a Reply

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注