How to hide PHP Warnings and Notices in WordPress
Hiding PHP warnings and notices in WordPress is not recommended as it can make it difficult to identify and troubleshoot potential issues on your website. Instead of hiding them, it’s better to address the root cause of the warnings and notices. However, if you have a specific reason to temporarily suppress them or if you’re working in a development environment.
The solution:
If you simply set WP_DEBUG
to false
in your wp-config.php
file you should be fine. These don’t affect your site in any way. Add the below code in your wp-config.php file:
define('WP_DEBUG', false);
OR you can also add the below code in your wp-config.php file for completelly remove the notices and warning from your WordPress pages:
ini_set('display_errors','Off');
ini_set('error_reporting', E_ALL );
define('WP_DEBUG', false);
define('WP_DEBUG_DISPLAY', false);
I hope the above solutions helps you. Share your love by sharing this tutorial on social media. Thanks!