Errors in coding happens, it can be a missing semicolon, an undefined function, or even a duplicate function caused by your code or conflicting plugins, either way sooner or later you will have an error. Now normally you can just see what the error is without issue. In an effort to prevent a security issue, WordPress just gives you a generic error message with no information other than a critical error has occurred. The error page prevents sensitive information from being shown to whoever may come across it. What happens when you need to know the error though? Is there a way to see errors that WordPress is hiding?
The default WordPress errors are not useful at all. Luckily we can change that!
Luckily the answer is yes, with WP_DEBUG it is easy to have them show on the website. Open up your wp-config.php file. In there find:
define( 'WP_DEBUG', false );
When you locate that, just change the false to true. If you cannot find that, then simply insert the following line of code:
define( 'WP_DEBUG', true);
If you’re inserting the code, be sure that you are inserting it above:
if ( ! defined( 'ABSPATH' ) ) {
Remember to set WP_DEBUG back to false when you are done with it, you don’t want to leave your site open to a potential security issue. If you do want to leave debugging on, then I suggest making it so it is only on for your IP address like this:
if($_SERVER['REMOTE_ADDR']=="YOUR IP ADDRESS"){
define( 'WP_DEBUG', true );
}
else{
define( 'WP_DEBUG', false );
}
And that’s all there is to it. Good luck solving your coding errors!