How to hide PHP Warnings and Notices in WordPress

We Developer many time fetch problem with warning message that display on front end site. Warning is like notification and completely different than Errors. Error stop page from rendering in browser while warning not cause issue in script execution but display message with message with prefix WARNING :.

So in most of cases of Warning these are nothing to worry about it. Only the developer of website should know about these so that they may fix them in a new upcoming release.

The solution:
To hide warning from displaying in page you simply set WP_DEBUG to false in your wordpress wp-config.php file which is not affect your site functionality, performance or any layout related display look.

To set WP_DEBUG false in wp-config.php file you need FTP access or Hosting Control Panel access. By these access you easily locate wp-config.php file placed at your wordpress setup root directory.

define('WP_DEBUG', false);

However, some times even you set WP_DEBUG to false than also the problem of showing Warning message in page still exist.

Mostly it happen with some shared hosting services who force to displaying PHP warnings message.

In such case, when only set WP_DEBUG to false not work than you can solve out it by replace above line by given below 6 syntax in wordpress wp-config.php file.

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

Leave comment if it not work for you or you using any other method to hide PHP Warnings and Notices in WordPress.

Scroll to Top