How to hide error reporting and fatal error in WordPress

  • January 19, 2016
  • vsnadmin
  • 1 min read

How to hide error reporting and fatal error in WordPress? When you create your company blog or website with WordPress, you may not want WordPress error messages to display on the screen and potentially discourage users from continuing to use your website. You can hide errors in WordPress by editing the WordPress configuration file and entering PHP directives to suppress error messages. Enter additional directives to have WordPress write the error messages to a log file that you can review on a regular basis and use to address any problems with the site.

The default declaration for the WordPress is following:

define(‘WP_DEBUG’, false);

But in some cases some WordPress installation need much more to hide due to install of a incompatible plugin or theme. If the previous code doesn’t work then you may use the following code.

Try inserting this in your index.php

ini_set(‘display_errors’, 0);

Or this in .htaccess

# supress php errors
php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off
php_value docref_root 0
php_value docref_ext 0

Leave a Reply

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

Open chat
Need Help?
Welcome to Virtuanic Solutions, thank you for reaching us!