Turn Off PHP Errors in WordPress

PHP warnings and notices are intended for the developers to facilitate help in debugging the problems with their code. Sometimes these warnings and notices are also visible to the website users. This does not look good. To get rid of these types of issues, you can turn off PHP errors in WordPress.

Understanding When to Turn Off PHP Errors in WordPress:

PHP errors are different from the internal server error, syntax errors, and fatal errors. These are warnings and notices that cause no hindrance in loading your WordPress website. They are there as a helping feature for the PHP developers. They make debugging easier. Also, they facilitate information regarding the compatibility and best practices to the plugin and theme developers.

Other than for the debugging purpose, the PHP errors are meant to be hidden. Displaying these warnings and notices on the website pages is not-at-all professional. To turn off these errors, you can take one of the below-mentioned routes.

Contact your theme or plugin developer:

Contacting the author or developer of the respective theme or plugin will ease your task. On asking for the desired fix, they may resolve the issue for you.

If you want to take the matter into your hands, you can look for the next solutions on the list.

Turn Off PHP Errors in WordPress:

To turn off the PHP errors in WordPress. you can follow the below steps:

  • Open your wp-config.php file.
  • Locate the below code line:

define(‘WP_DEBUG’, true);

  • If the above code is already set to false, it will look like this:

define(‘WP_DEBUG’, false);

  • Whatever the case is, replace the line with the below code:

ini_set(‘display_errors’,’Off’);

ini_set(‘error_reporting’, E_ALL );

define(‘WP_DEBUG’, false);

define(‘WP_DEBUG_DISPLAY’, false);

  • Save the changes.
  • Upload the wp-config.php file back to the server.
  • Reconnect to your website.
  • The PHP errors, notices, and warnings should have disappeared from your website.

Turning On PHP Errors in WordPress:

To turn On PHP Errors in WordPress, you can follow the below steps:

  • Open your wp-config.php file.
  • Replace the changed code with the below code:

define(‘WP_DEBUG’, true);

define(‘WP_DEBUG_DISPLAY’, true);

  • Save the changes.
  • Upload the wp-config.php file back to the server.
  • Reconnect to your website.
  • WordPress will again start displaying PHP errors, warnings, and notices.