今天不知道怎么回事发现媒体库进不去提示JS错误,富文本编辑器无法启动(似乎早就发生了,但是今天我才笨拙的发现)。。
重大事故,各种还原,清理缓存,重启服务器,对照修改.php文件都没用。凭借三天前的那个备份大胆的试了十多种方法(还特意备份了这三天的十多篇文章),全都没用,百度上全都是骗人的。着急到自闭。。
于是想起来了类比windows系统的安全模式,是不加载外部程序的。那么我也全部关闭wordpress的外部插件,让wordpress的插件们逐一启动,然后看看是在哪出的问题,最终启动到tinyMCE advance(富文本编辑器增强工具)时,炸了。
原因据我推测,可能是我以前手动在function.php增强过自带的tinyMCE编辑器。然后这个插件在function.php插入增强函数和我写的名字一样,,就冲突无法显示了。。
我曾写的wordpress编辑器增强代码
//编辑器增强功能 function add_more_buttons($buttons) { $buttons[] = 'hr'; //水平线 $buttons[] = 'fontselect'; //字体 $buttons[] = 'fontsizeselect'; //字号 $buttons[] = 'styleselect'; //样式,格式 $buttons[] = 'wp_page'; //分页符 $buttons[] = 'cut'; //剪切 $buttons[] = 'backcolor'; //背景色 return $buttons; } add_filter("mce_buttons_3", "add_more_buttons");//------------>在这一行发生冲突 //添加字体 function add_fontfamily($initArray){ $initArray['font_formats'] ="幼圆='幼圆';英文可爱字体=comic sans ms,sans-serif;微软雅黑='微软雅黑';宋体='宋体';黑体='黑体';仿宋='仿宋';楷体='楷体';隶书='隶书';Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=v erdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats"; return $initArray; }
function.php的冲突直接导致了PHP编译生成的html的首行不是<!DOCTYPE html>
不符合标准(PS:<!DOCTYPE> 声明帮助浏览器正确地显示网页。)
于是就崩溃了。
解决方案就是:禁用所有插件,控制变量,逐一启动,看看到底是谁在作妖,然后干掉。
抢救历时4个半小时,心态也炸了好几次。。。不过还好最后成功了!
血和泪的教训告诉我们:
一定要备份!
一定要备份!!
一定要备份!!!
老老实实的三个小时,大写加粗血红的一定要备份
感动么?不敢动不敢动。。