WordPress does have its own debugging mechanism called "WP_DEBUG" to fix the code issues. It is very helpful to debug and identify unknown issues that starts appearing on WordPress websites.
When enabled, WP_DEBUG will show PHP notices, debug
messages and deprecated function alerts. By
carefully examining these errors & notices, you can easily identify and update
required components of the WordPress or PHP.
By default, WP_DEBUG would be is disabled, to enable WP_DEBUG, you just need to add single line of code in wp-config.php file.
define('WP_DEBUG', True );
Enabling WP_DEBUG will fire some additional commands which may increase page load time. Therefore, it is advisable to keep it disabled
unless you need it. After enabling the WP_DEBUG, WordPress
will start generating errors & logs and they will be recorded in
debug.log file. The location of debug.log file is "wp-content" folder.
You can explore this file to see the list of errors, logs & alerts
of your WordPress blog.
define ( 'WP_DEBUG_LOG', true);
define ( 'WP_DEBUG_DISPLAY', false);
It is also necessary to turn on the WP_DEBUG_LOG & turn off WP_DEBUG_DISPLAY feature which will start saving all errors to a
Disabling of WP_DEBUG_DISPLAY will start saving all these logs to your log file.
Important: If you're trying to debug something on your live site, use
WP_DEBUG with "DISPLAY" feature "OFF". If this is not done, all the
errors and notices will start appearing on the front-end and visible to
your site visitors.