Set the error reporting level in WP
-
One of the annoyances of working with WordPress I’ve had for ages is trying to use the error_reporting() function to do something like temporarily turn off deprecation warnings; WordPress ignores these settings entirely.
Turns out the cause of this is the wp_debug_mode() function, which gets called by wp-settings.php and sets error_reporting(E_ALL). As a result, putting your own call to the error_reporting() function in wp-config.php won’t have any effect; you need to place your call after wp_debug_mode() runs. One smart solution is to create a very simple mu-plugin for this purpose.Managed to find the above while trying to find an answer to my question i.e. how to set error reporting levels for php in WP. So in wp-settings.php I’ve got a call to my function:
setErrorLevel();
after the line containing wp_debug_mode() and in my mu-plugins folder I’ve got a file called myConfigSettings.php which has the following function:<?php function setErrorLevel(){ } ?>
But I’m getting error
PHP Fatal error: Uncaught Error: Call to undefined function setErrorLevel() in C:\Users\Fergus\Local Sites\university01\app\public\wp-settings.php:82
Any suggestions please how to resolve this?
- The topic ‘Set the error reporting level in WP’ is closed to new replies.