PHP warnings and notices are very useful when developing something in PHP, as it is a good way to receive a “feedback” from the code. But most of the time, PHP warnings and notices are nothing to worry about on a production site – sometimes it’s just a developer developer trying to keep compatibility with older versions of WordPress – and this can harm the user experience.
I recently went through this problem on a client website. He was angry and sent me a message that his site was presenting errors, but when I checked, there was nothing to be fixed. I found the solution on the Aristath website, and I will share with you below.
Solution 1 – How to hide PHP warnings and notices in WordPress
The simple solution is to simple set
false in your wp-config.php (it don’t affect your website)
Sometimes the above solution may not work, especially if you are using a shared server. In these cases many of them require to display PHP Warnings and Notices.
Solution 2 – How to hide PHP warnings and notices in WordPress
If the solution 1 does not work, you can try swap the wp_debug line above for this snippet:
ini_set('display_errors','Off'); ini_set('error_reporting', E_ALL ); define('WP_DEBUG', false); define('WP_DEBUG_DISPLAY', false);
this will edit the settings of your server and solve the problem 🙂