0

WordPress is not displaying any errors / debug messages, even though I double- and triple-checked every setting.

In php.ini, I have

error_reporting = E_ALL & ~E_NOTICE display_errors = On display_startup_errors = On log_errors = On track_errors = On

In wp-config.php, I have:

define('WP_DEBUG', true); define('WP_DEBUG_LOG', true); define('WP_DEBUG_DISPLAY', true); @ini_set('display_errors', 1); error_reporting(E_ALL^E_NOTICE);

Still, no errors are displayed at all. I verified that it is not a general PHP issue by testing it with an erroneous php file, like this: <?php askdjh akjdsh ?>. The error was displayed correctly.

1 Answer 1

2

The problem was caused by a plugin (wp-spamfree), which simply set error_reporting(0).

So if anyone has the same problem, my advice is to search your whole wp-content/plugins directory for words like error_reporting, display_errors and similar to find out if any of your plugins tamper with these settings.

You can either disable these plugins, or fix it yourself for now and let the developers know that they should not do this.

Fixes:

  1. One way to fix this is to simply remove the unwanted error_reporting(0).

  2. However, if you want to make sure that the plugin won't display any errors (which I think is stupid), another way would be to replace error_reporting(0) with $errlvl = error_reporting(0);.

    This will save your current, desired error reporting level in $errlvl. The function will be executed with error_reporting = 0. At the end of the function you can then reset it back to the previous, desired level by calling error_reporting($errlvl);.

2
  • .... or better, not to use plugin of anyone that writes this kind of code to hide error :( Commented Jan 30, 2017 at 15:43
  • Yeah... I think I'll drop that addon anyway. I'm not even sure whether it's still alive or not. Most of the forum posts on wordpress.org are pretty old (1+ years) and say it's no longer working. However, the plugin page states that it was updated 4 months ago. shrug
    – Ginchen
    Commented Jan 30, 2017 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.