如何阻止 PHP 通知出现在 wordpress 中? [英] How can I stop PHP notices from appearing in wordpress?
问题描述
我知道error_reporting(0);
和ini_set('display_errors', false);
,但是wordpress中出现了一个通知:
I know about error_reporting(0);
, and ini_set('display_errors', false);
, but there is a notice appearing in wordpress:
注意:/var/www/vhosts/treethink.net/subdomains/parkridge/httpdocs/wp-includes/formatting.php 中的数组到字符串转换 359>
Notice: Array to string conversion in /var/www/vhosts/treethink.net/subdomains/parkridge/httpdocs/wp-includes/formatting.php on line 359
它只出现在 wordpress 中,而不出现在网站的任何其他页面中.
it only appears in wordpress, not in any other pages of the site.
我检查了phpinfo()
,一切都设置好了,所以不会显示错误.为什么这个还出现?
I checked phpinfo()
, and everything is set so that errors are not displayed. Why does this one still show up?
这是产生错误的行:
function wp_check_invalid_utf8( $string, $strip = false ) {
$string = (string) $string;
我确实改变了 wordpress 中的一些东西,以改变画廊的运作方式.但不是这个函数,我认为我也没有改变对这个函数的任何调用.除了出现通知之外,一切似乎都运行良好,我只需要隐藏此错误即可.
I did change some thing in wordpress, to change how the gallery worked. But not this function, and I don't think I changed any calls to this function either. Aside from the notice appearing, everything seems to operate perfectly fine, I just need to get this error to hide.
推荐答案
您需要编辑您的:
wp-config.php
文件并在此处修改以下内容:
file and modify the following here:
error_reporting(0);
@ini_set('display_errors', 0);
否则 Wordpress 会覆盖 PHP.INI 设置的警报
otherwise Wordpress overwrites the ALERTS set by PHP.INI
这篇关于如何阻止 PHP 通知出现在 wordpress 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!