How to hide errors and warnings on your website in Hostinger

Hide errors and warnings on your website in Hostinger using the WordPress wp-config.php file, the .htaccess file, or a single .php file.

Updated 19 hours ago

Hide errors and warnings on your website in Hostinger to keep PHP error messages away from visitors once you finish debugging. There are three methods: edit the WordPress wp-config.php file, add a rule to the .htaccess file, or hide errors on a single page through its .php file.

Option 1 – WordPress configuration file

If your website is WordPress-based, go to the File Manager and open your public_html/wp-config.php file. Next, check if any of these lines are present:

define('WP_DEBUG', true);
define('WP_DEBUG', false); 

If either one of them or both are present, remove them. Next, add the following code:

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

PHP errors are now hidden on your WordPress website.

Option 2 – .htaccess file

Go to the File Manager and open your public_html/.htaccess file. If there is no .htaccess file, you can create it. Next, add the following line:

php_flag display_errors off

Save the changes, and the PHP errors will no longer be displayed on the website.

Option 3 – .php file

If you want to hide PHP errors from a single session or page of your website, go to the File Manager and open the desired page’s .php file. Next, add the following line:

error_reporting(0);

Save the changes, and now the PHP errors will be hidden on this particular page.

PHP errors and warnings are now hidden from your website visitors. To show them again while debugging, see How to display PHP error messages in Hostinger.