TermsBox
PricingBlog
LoginGet Started
PricingBlogLogin
Get Started
  1. Home
  2. Install guides
  3. WordPress

Install the TermsBox Cookie Consent Banner on WordPress

This guide shows you how to add the TermsBox consent banner to a WordPress website. Pick the option that matches how comfortable you are with your site. Option A uses a free plugin and needs no code knowledge. Option B edits your theme files directly.

There is no official TermsBox WordPress plugin yet. The methods below use the same small script tag that works on any website, so both options are fully supported.


What you need

Before you start, get your install snippet from your TermsBox dashboard:

  1. Log in to your TermsBox account.
  2. Go to Consent Banner in the left menu, then open the Install tab. (Direct link: /dashboard/banner.)
  3. You will see a ready-to-copy script tag. Click the copy button.

Your snippet looks like this, with your own site id already filled in:

<script src="https://termsbox.com/cmp/termsbox-cmp.js" data-site-id="YOUR_SITE_KEY" data-auto-block="on"></script>

Notes:

  • YOUR_SITE_KEY is your unique site id. The dashboard fills this in for you automatically, so always copy the snippet from there rather than typing it by hand.
  • The snippet is also shown during first-time setup, on the "Getting Started" card on your dashboard home, and on the success page after checkout. It is not shown under Settings, so look under Consent Banner if you cannot find it.

Where the snippet goes

The script must load in the <head> section of your pages, and it must load site-wide (on every page), so the banner shows everywhere.

Important: do not add async or defer to the script tag, and do not load it through a tag manager that loads scripts asynchronously. The banner needs to run early and in order to block trackers before they fire. The copy-paste snippet is already correct. Just paste it exactly as given.


Option A: Use a header code plugin (easiest, no coding)

This uses a free plugin that lets you paste code into your site header without touching theme files. Two popular choices are WPCode and Insert Headers and Footers (by WPBeginner). The steps are almost identical for both.

  1. In your WordPress admin, go to Plugins > Add New.
  2. Search for WPCode (or Insert Headers and Footers).
  3. Click Install Now, then Activate.
  4. Open the plugin settings:
    • For Insert Headers and Footers: go to Settings > Insert Headers and Footers.
    • For WPCode: go to Code Snippets > Header & Footer.
  5. Find the box labelled Header (sometimes called "Scripts in Header" or "<head>").
  6. Paste your TermsBox snippet into that Header box.
  7. Click Save (or Save Changes).

That is it. The plugin now adds the script to the <head> of every page for you.

Tip: Always paste into the Header box, not the Body or Footer box. The Footer box loads too late for the banner to work correctly.


Option B: Edit your theme (child theme recommended)

Use this if you prefer not to install a plugin. Edit a child theme so your changes are not lost when the main theme updates. There are two ways to do it. Method B1 (functions.php) is the cleaner, recommended choice.

Before you start

  • Back up your site, or at least note how to undo changes.
  • Confirm you are editing a child theme, not the parent theme. If you do not have a child theme, ask your developer to set one up first, or use Option A instead.

Method B1: Add it with functions.php (recommended)

This tells WordPress to print the script into the <head> on every page.

  1. In your WordPress admin, go to Appearance > Theme File Editor.

  2. On the right, make sure your child theme is selected.

  3. Open the file named functions.php.

  4. Scroll to the very bottom and paste this code. Replace YOUR_SITE_KEY with your real site id from the dashboard:

    function termsbox_add_consent_banner() {
        ?>
        <script src="https://termsbox.com/cmp/termsbox-cmp.js" data-site-id="YOUR_SITE_KEY" data-auto-block="on"></script>
        <?php
    }
    add_action( 'wp_head', 'termsbox_add_consent_banner' );
  5. Click Update File.

The wp_head hook prints your script inside the <head> section on every page, which is exactly what you want.

Method B2: Edit header.php directly

Only use this if you cannot use Method B1. Editing header.php is more fragile because the file changes between themes.

  1. Go to Appearance > Theme File Editor.

  2. Make sure your child theme is selected.

  3. Open the file named header.php.

  4. Find the closing head tag, which looks like this:

    </head>
  5. Paste your TermsBox snippet on the line directly above </head>. Replace YOUR_SITE_KEY with your real site id:

    <script src="https://termsbox.com/cmp/termsbox-cmp.js" data-site-id="YOUR_SITE_KEY" data-auto-block="on"></script>
    </head>
  6. Click Update File.


Verify it works

  1. Open your website in a normal browser tab (visit your homepage).
  2. If you have visited before, open a private or incognito window so the banner is not already dismissed. Reload the page.
  3. Look for the TermsBox consent banner to appear. It usually shows near the bottom or as a small popup.
  4. Go back to your TermsBox dashboard, open Consent Banner > Install, and click the Verify Installation button.
  5. When the check passes, the status changes to verified. If it does not pass the first time, wait a few seconds and try again, then see Troubleshooting below.

How the verify button works: TermsBox visits your site's main URL and looks for the script tag in the page HTML. It checks the homepage you registered, so make sure the snippet is installed site-wide and that your homepage is publicly reachable.


Troubleshooting

The banner does not appear.

  • Make sure you saved your changes. In Option A, re-open the plugin and confirm the snippet is still in the Header box. In Option B, confirm the code is still in the file.
  • Confirm you pasted into the Header area, not the Footer or Body.
  • Clear your site cache. Many WordPress hosts and caching plugins (for example WP Rocket, W3 Total Cache, or a host page cache) serve an old copy. Clear the cache, then reload in a private window.
  • Check that you copied the whole snippet, including the closing </script>.

The banner shows, but "Verify Installation" still fails.

  • The verifier checks your main site URL. If your homepage is password protected, still under construction, blocked to bots, or served differently to visitors, the check can fail even though real visitors see the banner. Make sure your homepage is publicly visible, then try again.
  • Some security services (for example a strict firewall or bot protection) may block the verifier. If your banner clearly appears for real visitors, your install is fine even if the button struggles.
  • Wait a few seconds between attempts. The verify button is limited to a few tries per minute.

The banner appears but seems empty or does not remember choices.

  • This usually means the site id is missing or wrong. Re-copy the snippet from the dashboard so data-site-id has your real key, and paste it again. Do not type the key by hand.

Do not add async or defer.

  • If someone added async or defer to the tag, or loaded it through a tag manager that loads scripts asynchronously, remove that. The tag must load normally and early in the <head>. Use the exact snippet from the dashboard.

Quick reference

  • Snippet source: your TermsBox dashboard, Consent Banner > Install tab.
  • Placement: inside <head>, on every page, loaded normally (no async, no defer).
  • Verify: Verify Installation button on the same Install tab.
View install guides for all platforms
TermsBox

Scan your website, auto-generate legal documents, add a consent banner, and stay compliant. One platform for everything.

Product

  • Cookie Scanner
  • Consent Banner
  • Cookie Policy Generator
  • Pricing

Generators

  • Privacy Policy Generator
  • Terms and Conditions Generator
  • EULA Generator
  • Disclaimer Generator
  • Return and Refund Policy Generator

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service
  • Cookie Policy
GDPR
ePrivacy
CCPA
LGPD
Google Consent Mode v2
IAB TCF 2.2
© 2026 TermsBox. All rights reserved.