Moved wpdb global call to the top.