| 开发者 | sogodigital |
|---|---|
| 更新时间 | 2026年6月21日 14:48 |
| PHP版本: | 8.0 及以上 |
| WordPress版本: | 7.0 |
| 版权: | GPL-2.0-or-later |
| 版权网址: | 版权信息 |
sogo_consent. It uses SameSite=Lax and Secure (HTTPS only). The cookie contains the consent status, timestamp, policy version, banner mode, and category choices. No consent data is stored in the WordPress database.
Developer integration
A public JavaScript API is available on every page after the plugin loads:
window.SogoConsent.getConsent() — returns the current consent object or nullwindow.SogoConsent.hasConsented() — returns true if valid consent existswindow.SogoConsent.resetConsent() — clears the cookie and re-shows the bannerdocument.addEventListener('sogoconsent:change', function(e) { console.log(e.detail); });
Use this event to activate or deactivate analytics or marketing scripts based on the visitor's choice.
Cache compatibility
The banner HTML is always present in the page source (hidden via the hidden attribute). JavaScript reads the consent cookie on DOMContentLoaded and decides whether to show the banner. This approach works with full-page caching plugins.
RTL and Hebrew support
The plugin auto-detects the WordPress admin language via is_rtl(). On Hebrew installs, all admin labels and default banner text are in Hebrew. The frontend CSS includes scoped RTL layout rules for the modal, toggle, and card positioning.
What this plugin does NOT do
sogo-consent folder to /wp-content/plugins/.No. The plugin shows a consent banner and records the visitor's choice in a browser cookie. It provides a public JavaScript API (window.SogoConsent) and a DOM event (sogoconsent:change) so your own code, Google Tag Manager, or another tool can activate or deactivate scripts based on the visitor's consent. Script blocking is not handled by this plugin.
Consent is stored entirely in the visitor's browser as a first-party cookie named sogo_consent. No consent data is stored in the WordPress database.
Yes. The banner HTML is always rendered in the page source and hidden with the hidden attribute. JavaScript reads the consent cookie client-side on page load. This approach is compatible with full-page caching plugins.
Update the Policy Update Version value in the Behaviour tab (for example, change 1.0 to 1.1). Any visitor whose saved consent was recorded under the old version will see the banner again the next time they visit.
Yes. Hebrew translations are bundled with the plugin. On Hebrew installs, admin labels and default banner text are displayed in Hebrew automatically. No additional translation files need to be installed.
Add the shortcode [sogo_consent_reset] to any page, post, or widget. Clicking it clears the visitor's consent cookie and shows the banner again.
No. The plugin provides a consent interface as a starting point. Whether your implementation meets legal requirements depends on your region, audience, and the specific cookies your site sets. Consult a qualified legal or privacy professional.
When auto-hide is enabled, the banner closes automatically after the number of seconds you set. The consent record is saved with status: auto_dismissed. This is not treated as consent to analytics or marketing cookies — those remain false in the consent record.
window.SogoConsent) or the sogoconsent:change event.