黄聪:wordpress前台自定义用户,调用wp_editor上传附件提示【抱歉,出于安全的考虑,不支持此文件类型】错误。
2015-07-27 16:48
197 查看
1、直接禁用文件类型检测,在wp-config.php文件中,添加这样一句代码define('ALLOW_UNFILTERED_UPLOADS', true);
2、在functions.php里面,添加下面代码(最重要是黄色背景那2句):
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' ); ?>
相关文章推荐
- 忽然领悟了云的含义
- 【LeetCode 241】Different Ways to Add Parentheses
- CAS流程源码分析。
- Android View.onMeasure方法的理解
- SVN与其他工具整合
- maven常见命令
- 图结构练习——判断给定图是否存在合法拓扑序列
- Android API Guides 阅读笔记(4)----Fragment
- Jetty和Tomcat的选择
- 设置滚动效果
- Document.getElementById 与 $('#id')的区别
- 重拾Excel之为什么
- 几个不常用但是很好用的PHP数组函数
- 《Java Concurrency in Practice》之线程封闭(Thread Confinement)
- VIM常用方法记录
- GTK常用控件之窗口( GtkWindow )
- Android Fragment+ViewPager实现循环滑动
- BZOJ1011
- [Android]ToolBar使用详解(一)——项目配置
- JSON数据的生成