9951 explained code solutions for 126 technologies


php-wordpressHow to disable PHP warnings in WordPress?


To disable PHP warnings in WordPress, you can add the following code to your wp-config.php file:

error_reporting(0);
@ini_set('display_errors', 0);

This will suppress all PHP warnings and errors from being displayed on the WordPress site.

Code explanation

  • error_reporting(0); - This line sets the error reporting level to 0, which will suppress all warnings and errors.
  • @ini_set('display_errors', 0); - This line sets the display_errors setting to 0, which will prevent any errors from being displayed on the WordPress site.

Helpful links

Edit this code on GitHub