WordPress debug messages not displaying

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);.

tech