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

Perth Ngarmtrakulchol
1 min readApr 21, 2016

--

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.

Originally published at Woratana Perth.

--

--

Perth Ngarmtrakulchol

Data Consultant at Servian | Monash Data Science Alumni | Front-end Developer based in Melbourne, Australia | LinkedIn: http://bit.ly/lkdn-perth