Debugging Errors in PHP and WordPress
Check your code on a php validator like PHP Code Checker
This code should be added at the top of a php file to show errors:
error_reporting(E_ALL);
error_reporting(-1);
ini_set(‘error_reporting’, E_ALL);
If your on wordpress, make sure to enable debug mode in wp-config.php in the root of your site’s web directory:
define( ‘WP_DEBUG’, true );
Make sure that you don’t leave this turned on for production sites, since some errors might show information to your users that you’d rather them not see (like a password or path to a directory)