wordpress begin主题报错处理方法
一些使用wordpress begin主题的网友发现,从虚拟主机换成了vps,一通wordpress搬家操作。域名解析更换且成功后,浏览网站,出现这么一大串:文章源自公式库网-https://www.gongshiku.com/html/202011/wordpress-beginzhutibaocuochulifangfa.html
constant gallerytag – assumed ‘gallerytag’ (this will throw an Error in a future version ofPHP) in……文章源自公式库网-https://www.gongshiku.com/html/202011/wordpress-beginzhutibaocuochulifangfa.html
constant videotag – assumed ‘videotag’ (this will throw an Error in a future version of PHP) in……文章源自公式库网-https://www.gongshiku.com/html/202011/wordpress-beginzhutibaocuochulifangfa.html
constant taotag – assumed ‘taotag’ (this will throw an Error in a future version of PHP) in……文章源自公式库网-https://www.gongshiku.com/html/202011/wordpress-beginzhutibaocuochulifangfa.html
constant filtersa – assumed ‘filtersa’ (this will throw an Error in a future version of PHP) inconstant filtersb – assumed ‘filtersb’ (this will throw an Error in a future version of PHP) in……文章源自公式库网-https://www.gongshiku.com/html/202011/wordpress-beginzhutibaocuochulifangfa.html
……文章源自公式库网-https://www.gongshiku.com/html/202011/wordpress-beginzhutibaocuochulifangfa.html
以上这些错误大概意思是“使用了未定义的常量gallerytag、videotag、taotag、filtersa、filtersb,这将在未来的PHP版本中引发错误“;文章源自公式库网-https://www.gongshiku.com/html/202011/wordpress-beginzhutibaocuochulifangfa.html
怎么会这样,细一思考,这其实不怪wordpress,而是用的是“知更鸟”主题,这个主题有很多字段模型,如上面的gallerytag、videotag等,这都是主题附带的。文章源自公式库网-https://www.gongshiku.com/html/202011/wordpress-beginzhutibaocuochulifangfa.html
那解决方法有两种:文章源自公式库网-https://www.gongshiku.com/html/202011/wordpress-beginzhutibaocuochulifangfa.html
一、升级主题,这个不太现实。文章源自公式库网-https://www.gongshiku.com/html/202011/wordpress-beginzhutibaocuochulifangfa.html
二、只是报了”Warning警告“,我能不能不让这些错误信息显示?
看来只需要关闭”PHP错误提示“就行了。宝塔面板中操作如下:
进入php管理,点“配置修改”,设置display_errors为关闭,然后保存,重启一下服务。
就这么简单。
如果不是在宝塔面板,那就要深入腹地,修改php.ini文件。
1、打开 php.ini
2、设置 error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
3、设置 display_errors = Off
其实两个方法,只是方式不同,改的都是同一个东西。