Domanda

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.

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a wordpress.stackexchange
scroll top