Skip to content

Commit 7b87ab0

Browse files
Merge pull request #172 from wp-slimstat/bugfix/multiple-fixes
Fix: Prevent missing dependency error when WP Consent API is not inst…
2 parents b9629bb + 2648cb0 commit 7b87ab0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

wp-slimstat.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,10 @@ public static function enqueue_tracker()
10951095
// Add dependencies for consent integrations (e.g., WP Consent API)
10961096
$dependencies = [];
10971097
if ((self::$settings['consent_integration'] ?? '') === 'wp_consent_api') {
1098-
$dependencies[] = 'wp-consent-api';
1098+
// Only add dependency if the WP Consent API script is actually registered
1099+
if (wp_script_is('wp-consent-api', 'registered') || wp_script_is('wp-consent-api', 'enqueued')) {
1100+
$dependencies[] = 'wp-consent-api';
1101+
}
10991102
}
11001103

11011104
// Register the correct script for adblock bypass, CDN, or default

0 commit comments

Comments
 (0)