https://brightbrightgreat.com/2016/03/24/how-to-log-mysql-errors-in-wordpress/ //————————————————- // Database logging – query errors // // email database query errors to the contact // specified // // @param n/a // @return n/a function db_debug_log(){ //WP already stores query errors in this obscure //global variable, so we can see what we’ve ended //up with just before shutdown global $EZSQL_ERROR; try { //proceed if there were MySQL errors during runtime if(is_array($EZSQL_ERROR) && count($EZSQL_ERROR)) { //build a log entry $xout = array(); //let’s start with some environmental information $xout[] = “DATE: ” . current_time(‘r’); $xout[] = “SITE: ” . site_url(); $xout[] = “IP: ” . $_SERVER[‘REMOTE_ADDR’]; $xout[] = “UA: ” . $_SERVER[‘HTTP_USER_AGENT’]; $xout[] = “SCRIPT: ” . $_SERVER[‘SCRIPT_NAME’]; $xout[] […]