Skip to content

Commit ee26f91

Browse files
Merge pull request #161 from pressidium/next
1.8.1
2 parents 6d11497 + d2dd237 commit ee26f91

File tree

6 files changed

+35
-20
lines changed

6 files changed

+35
-20
lines changed

includes/Client/Cookie_Consent.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Pressidium\WP\CookieConsent\Hooks\Filters;
1616

1717
use Pressidium\WP\CookieConsent\Settings;
18+
use Pressidium\WP\CookieConsent\Utils\WP_Utils;
1819

1920
if ( ! defined( 'ABSPATH' ) ) {
2021
die( 'Forbidden' );
@@ -94,6 +95,11 @@ private function get_settings(): array {
9495
* @return void
9596
*/
9697
public function enqueue_scripts(): void {
98+
if ( WP_Utils::is_ninja_forms_preview() ) {
99+
// Ninja Forms preview, do not enqueue scripts
100+
return;
101+
}
102+
97103
$assets_file = PLUGIN_DIR . 'public/bundle.client.asset.php';
98104

99105
if ( ! file_exists( $assets_file ) ) {
@@ -211,7 +217,7 @@ private function print_consent_mode_inline_script(): void {
211217
function onPressidiumCookieConsentUpdated(event) {
212218
window.dataLayer = window.dataLayer || [];
213219
window.dataLayer.push({
214-
event: 'pressidium-cookie-consent-' + event.type,
220+
event: event.type,
215221
consent: event.detail,
216222
});
217223
}

includes/Plugin.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,26 +67,12 @@ public function mark_as_activated(): void {
6767
$this->just_activated = true;
6868
}
6969

70-
/**
71-
* Load plugin text domain.
72-
*
73-
* @return void
74-
*/
75-
public function load_textdomain(): void {
76-
load_plugin_textdomain(
77-
'pressidium-cookie-consent',
78-
false, // this parameter is deprecated
79-
dirname( plugin_basename( __FILE__ ) ) . '/languages'
80-
);
81-
}
82-
8370
/**
8471
* Add WordPress hooks.
8572
*
8673
* @return void
8774
*/
8875
private function add_hooks(): void {
89-
add_action( 'init', array( $this, 'load_textdomain' ) );
9076
add_action( 'init', array( $this, 'register_blocks' ) );
9177
}
9278

includes/Utils/WP_Utils.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,17 @@ public static function get_domain(): string {
3636
return $domain;
3737
}
3838

39+
/**
40+
* Whether the current request is a Ninja Forms preview.
41+
*
42+
* @since 1.9.0
43+
*
44+
* @link https://wordpress.org/plugins/ninja-forms/
45+
*
46+
* @return bool
47+
*/
48+
public static function is_ninja_forms_preview(): bool {
49+
return isset( $_GET['nf_preview_form'] ) && isset( $_GET['nf_iframe'] );
50+
}
51+
3952
}

pressidium-cookie-consent.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: Pressidium Cookie Consent
44
* Plugin URI: https://github.com/pressidium/pressidium-cookie-consent/
55
* Description: Lightweight, user-friendly and customizable cookie consent banner to help you comply with the EU GDPR cookie law and CCPA regulations.
6-
* Version: 1.8.0
6+
* Version: 1.8.1
77
* Author: Pressidium
88
* Author URI: https://pressidium.com/
99
* Text Domain: pressidium-cookie-consent
@@ -27,7 +27,7 @@
2727
*/
2828
function setup_constants(): void {
2929
if ( ! defined( 'Pressidium\WP\CookieConsent\VERSION' ) ) {
30-
define( 'Pressidium\WP\CookieConsent\VERSION', '1.8.0' );
30+
define( 'Pressidium\WP\CookieConsent\VERSION', '1.8.1' );
3131
}
3232

3333
if ( ! defined( 'Pressidium\WP\CookieConsent\PLUGIN_DIR' ) ) {

readme.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Tags: cookie, consent, gdpr, ccpa, cookies
66
Requires at least: 6.0
77
Tested up to: 6.8
88
Requires PHP: 8.1
9-
Stable Tag: 1.8.0
9+
Stable Tag: 1.8.1
1010
License: GPLv2 or later
1111
License URI: http://www.gnu.org/licenses/gpl-2.0.html
1212

@@ -186,6 +186,13 @@ If you have spotted any bugs, or would like to request additional features from
186186

187187
== Changelog ==
188188

189+
= 1.8.1: Oct 16, 2025 =
190+
191+
* Fix an issue with the names of the custom events pushed to the data layer for Google Tag Manager
192+
* Revert the modal headings to use `div` instead of `h2` to fix potential SEO issues
193+
* Remove no longer necessary `load_plugin_textdomain()` (plugins hosted on WordPress.org don't need it)
194+
* Integrate with Ninja Forms to prevent the cookie consent banner from loading on form previews
195+
189196
= 1.8.0: May 5, 2025 =
190197

191198
* Bump minimum required PHP version to 8.1

src/client/lib/cookieconsent.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,10 @@
448448
if(consent_modal_title_value){
449449

450450
if(!consent_modal_title){
451-
consent_modal_title = _createNode('h2');
451+
consent_modal_title = _createNode('div');
452452
consent_modal_title.id = 'c-ttl';
453+
consent_modal_title.setAttribute('role', 'heading');
454+
consent_modal_title.setAttribute('aria-level', '2');
453455
consent_modal_inner_inner.appendChild(consent_modal_title);
454456
}
455457

@@ -570,7 +572,7 @@
570572
var settings = _createNode('div');
571573
var settings_container_inner = _createNode('div');
572574
settings_inner = _createNode('div');
573-
settings_title = _createNode('h2');
575+
settings_title = _createNode('div');
574576
var settings_header = _createNode('div');
575577
settings_close_btn = _createNode('button');
576578
settings_close_btn.appendChild(generateFocusSpan(2));
@@ -626,6 +628,7 @@
626628
settings_container.setAttribute('aria-modal', 'true');
627629
settings_container.setAttribute('aria-hidden', 'true');
628630
settings_container.setAttribute('aria-labelledby', 's-ttl');
631+
settings_title.setAttribute('role', 'heading');
629632
settings_container.style.visibility = overlay.style.visibility = "hidden";
630633
overlay.style.opacity = 0;
631634

0 commit comments

Comments
 (0)