How to hide PHP warnings and notice in WordPress
Sometimes you can see some PHP notices and warnings on your page. These warnings and notices are nothing to worry about on a production site most of the time.
Some of these can even be generated because the developer has to keep compatibility with older versions of WordPress as well as older PHP versions. Anyway this bothers and it must be hidden on the page.
The solution is to set WP_DEBUG to false in your wp-config.php file and it should be fine. These don’t affect your site in any way. However, the problem is that this may not always help. That can happen most times on cheap shared hosts that force displaying PHP warnings and notices.
In that case, you can replace this line from your 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);
In fact, WP_debug must always be disabled on a live site. Anyway, if it happens that it is active, we recommend you to disable it for security reasons.