[WordPress] Solution when define(‘WP_DEBUG’, false); is not working

Generally, when we added define(‘WP_DEBUG’, false); to wp-config.php, it should disable every warning & notice on the website.

However, there was one of the client website which is using shared hosting and Cpanel. On this site, define(‘WP_DEBUG’, false); is not working.

It seems like some shared hosting will not allow us to use turn off PHP errors.

The solution is to use these lines in place of WP_DEBUG:

ini_set('log_errors','On');
ini_set('display_errors','Off');
ini_set('error_reporting', E_ALL );
define('WP_DEBUG', false);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);

Now the errors are all gone 🙂 This is safe. It will not affect anything in your website.


Posted

in

, ,

by

Comments

Leave a Reply

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