1ConsentConsentDocs

WordPress Integration

Add consent management to your WordPress site using the official 1Consent plugin — no code required.

Installation

Install the plugin

  1. Download the 1Consent plugin ZIP
  2. In your WordPress admin, go to Plugins → Add New → Upload Plugin
  3. Upload the .zip file, click Install Now, then Activate Plugin

The plugin is distributed from this website. It is not listed in the WordPress.org plugin directory.

Configure your App ID

  1. Go to Settings → 1Consent in your WordPress admin
  2. Enter your App ID from your app's Installation page in the 1Consent dashboard
  3. Choose Live, Preview, or Staging
  4. For Preview, open Installation → Script Tag → Preview in the dashboard, select a GDPR or US draft, and copy the frameworkId value from its script URL into Preview framework ID
  5. Click Save Changes

Open your site's frontend to verify the banner. Live and Staging require a configuration published to that stage. Preview loads the selected draft; an empty Preview framework ID uses your app's existing configured routing. Select an explicit draft before the first publication. TCF previews remain private inside the dashboard. Add your WordPress domain to the app's allowed domains and clear any page cache after changing settings.

Plugin settings

SettingDescription
App IDYour unique 1Consent application identifier
StageLive (default), Preview for unpublished changes, or Staging for an available Staging publication
Preview framework IDPublic ID of the GDPR or US draft to test in Preview. Ignored in Live/Staging. Leave empty to use existing configured routing.

How it works

The plugin automatically:

  • Injects the 1Consent script into the <head> of every page
  • Runs at the earliest wp_head callback priority; your theme must call wp_head() before outputting third-party scripts
  • Respects your CMP configuration from the 1Consent dashboard

Testing

Use a separate app for testing. The downloaded plugin defaults to production services, including the dashboard connection. A local or development App ID belongs to its matching deployment.

Before connecting WordPress or entering a test App ID, add all three settings to wp-config.php, before the line that loads wp-settings.php. The dashboard origin controls account connection, private reporting and admin links; the other two origins control Live/Staging and Preview banner delivery.

Local development

define('ONECONSENT_DASHBOARD_URL', 'https://dashboard.1consent.local');
define('ONECONSENT_BOOTSTRAP_URL', 'https://web.cmp.1consent.local');
define('ONECONSENT_PREVIEW_BOOTSTRAP_URL', 'https://cmp.1consent.local');

Development release

define('ONECONSENT_DASHBOARD_URL', 'https://dashboard.1consent.dev');
define('ONECONSENT_BOOTSTRAP_URL', 'https://web.cmp.1consent.dev');
define('ONECONSENT_PREVIEW_BOOTSTRAP_URL', 'https://cmp.1consent.dev');

These deployment settings apply to both the banner and the dashboard connection. Live, Preview and Staging select a publication stage within that deployment; choosing Preview does not switch a production plugin to development services. Keep normal HTTPS certificate validation enabled, including when testing locally.

Remove the overrides when moving the WordPress site to production, then connect to the production app or enter its production App ID. A normal production installation needs no origin overrides.

Template-based blocking (advanced)

For performance-optimized setups, wrap third-party scripts in your theme with <template> tags:

<template data-1c-service-tag="google-analytics">
  <script src="https://www.googletagmanager.com/gtag/js?id=GA_ID"></script>
</template>

This prevents scripts from loading until the user grants consent for the associated service.

Troubleshooting

  • Verify your App ID is correct in Settings → 1Consent
  • Check that the plugin is activated
  • Ensure no caching plugin is serving a stale page — clear your cache

Conflicts with other plugins

The 1Consent plugin is designed to be lightweight and non-intrusive. If you experience conflicts:

  • Inspect the page source and ensure the 1Consent script appears before third-party scripts; a plugin cannot run before scripts hardcoded ahead of wp_head()
  • Disable other consent/cookie plugins that may interfere

Need help? Reach out via the 1Consent dashboard or email [email protected].

On this page