The PHP errors you often see on your WordPress site are usually notices and warnings. WordPress uses PHP as its programming language, and sometimes code notices and warnings may appear in different parts of the website.
 
In this guide, we show you how to hide WordPress PHP errors so that they only appear in your hosting error log:
 
  1. Disable real-time error display.  The first thing you need to do is disable the real-time display of errors. To do this, edit the wp-config.php file located in the root of your website and look for the following line:
 
define('WP_DEBUG', true);
 
Change "true" to "false" to disable real-time error display:
 
define('WP_DEBUG', false);
 
  1. Hide PHP errors:  In addition to disabling real-time error display, you can also hide PHP errors. To do this, the display_errors directive  in PHP must be disabled. You will also need to add the following lines to the wp-config.php file:
 
ini_set('error_reporting', E_ALL ); define('WP_DEBUG_DISPLAY', false);
 
These lines will hide any PHP errors that occur on your website.
 
In summary, to hide PHP errors in WordPress, you need to disable real-time error display and hide PHP errors directly from the wp-config.php file.
 
By doing so, you can keep your website running properly while still having a way to internally investigate any issues that may arise.