Replaced deprecated $wpdb->escape with esc_sql

Minor change that replaces deprecated $wpdb->escape with esc_sql that was causing notices with strict PHP settings