您的位置:首页 > 其它

黄聪:wordpress前台自定义用户,调用wp_editor上传附件提示【抱歉,出于安全的考虑,不支持此文件类型】错误。

2015-07-27 16:48 197 查看
1、直接禁用文件类型检测,在wp-config.php文件中,添加这样一句代码define('ALLOW_UNFILTERED_UPLOADS', true);

2、在functions.php里面,添加下面代码(最重要是黄色背景那2句):

<?
// 添加一个角色,允许地区编辑添加
add_role('dq_edit','地区编辑', array(
'level_3'      => true,
'read'         => true,
'edit_posts'   => true,
'edit_published_posts' => true,
'edit_others_posts'    => true,
'publish_posts'   => true,
'upload_files'   => true,  //允许上传文件
'unfiltered_upload'   => true, //允许上传不安全的文件
));

$role_object = get_role( 'dq_edit' );
//为角色对象添加权限$cap
$role_object->add_cap( 'edit_jihua' );
$role_object->add_cap( 'upload_files' );
?>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: