diff --git a/typo3/sysext/core/Classes/DataHandling/DataHandler.php b/typo3/sysext/core/Classes/DataHandling/DataHandler.php
index 7e491fb1503aecb0c25975561669c99932a6aace..1e20d2167d07911195e425052b5dfa5ffe653de4 100644
--- a/typo3/sysext/core/Classes/DataHandling/DataHandler.php
+++ b/typo3/sysext/core/Classes/DataHandling/DataHandler.php
@@ -5239,13 +5239,13 @@ class DataHandler implements LoggerAwareInterface
         ) {
             return;
         }
+        $languageField = $GLOBALS['TCA'][$table]['ctrl']['languageField'];
+        $localizationParentFieldName = $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'];
         $liveRecord = BackendUtility::getRecord($table, $uid);
-        if ((int)($liveRecord['sys_language_uid'] ?? 0) !== 0 || (int)($liveRecord['t3ver_wsid'] ?? 0) !== 0) {
+        if ((int)($liveRecord[$languageField] ?? 0) !== 0 || (int)($liveRecord['t3ver_wsid'] ?? 0) !== 0) {
             // Don't do anything if we're not deleting a live record in default language
             return;
         }
-        $languageField = $GLOBALS['TCA'][$table]['ctrl']['languageField'];
-        $localizationParentFieldName = $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'];
         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table);
         $queryBuilder->getRestrictions()->removeAll();
         $queryBuilder = $queryBuilder->select('*')->from($table)