Hide PHP Notices and Warnings

PHP notices and warnings are messages that you may sometimes see on your WordPress site.

Neither PHP notices nor warnings are a major problem for your site. You can safely hide them from display.

PHP notices are the least important. As stated on the official PHP website, you will see PHP notices when:

the script encountered something that could indicate an error, but could also happen in the normal course of running a script

Warnings deserve more attention but almost certainly won't break your website. According to the official PHP website, warnings are:

non-fatal errors. Execution of the script is not halted


How to hide notices and warnings

  • In the root of your WordPress website, find the wp-config.php file:
  • Find this following code. This may be set to “false” on some servers.
define('WP_DEBUG', true);

Replace that singe line of code with these four lines of code:

ini_set('display_errors','Off');
ini_set('error_reporting', E_ALL );
define('WP_DEBUG_DISPLAY', false);
define('WP_DEBUG', true);

Professional publishing plugins for WordPress! Get PublishPress

  • SUBSCRIBE TO OUR NEWSLETTER
  • SEARCH THIS SITE