How to hide PHP Warnings and Notices in WordPress

Share this post

Share on facebook
Share on twitter
Share on linkedin
Share on email
Share on whatsapp
Is the front end of your website displaying PHP errors like - wordpress Warning: A non-numeric value encountered in /home/customer/public_html/wp-includes/formatting.php on line 3770​
html code

Most of the time these are nothing to worry about (though the plugin/theme developer should know about these so that they may fix them in a future release). PHP 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.

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.

However, the problem is that some times the above does not work.
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:

define(‘WP_DEBUG’, false);

with this:

ini_set(‘display_errors’,’Off’);
ini_set(‘error_reporting’, E_ALL );
define(‘WP_DEBUG’, false);
define(‘WP_DEBUG_DISPLAY’, false);

Share this post

Share on facebook
Share on twitter
Share on linkedin
Share on whatsapp
Share on email

Leave a Comment

Your email address will not be published. Required fields are marked *

About The Web Grind

Get a better understanding of what it takes to run a successful online business

Recent Posts

CartFlows Woocommerce
CartFlows
Build sales funnels with Woocommerce & CartFlows
cartflows.com
Elementor page builder
elementor
Build a better WordPress website with Elementor
elementor.com
worpress for dummies
WP for Beginners
A Visual Step-by-Step Guide to Mastering WordPress
amazon.com
crocoblock
The ultimate toolkit for building websites with Elementor
crocoblock.com