Iubenda logo
Start generating


Table of Contents

Cookie Solution – WordPress Plugin Installation Guide

Besides maintaining records of consent for your web forms, our cookie consent plugin for WordPress allows you to automate the implementation of Cookie Law regulations (cookie policy, cookie banner and prior blocking), thus drastically reducing the need for direct interventions in the code of the site.

  • WordPress 4.0 or higher
  • PHP 5.2.4 or higher (5.3+ is recommended)
iubenda Cookie Solution Plugin for WordPress


  • Our WP cookie plugin automatically adds the iubenda code to all the pages of a site (to the HEAD section)
  • Allows the manual blocking of all other resources without direct intervention on the actual scripts
  • Manages the visualization of the cookie banner and of the cookie policy, as well as the saving of the consent preferences by the users regarding the installation of cookies
  • Allows the management of the iubenda Cookie Solution for multilingual sites using WPML. More information regarding this can be found in this article
  • It displays a clean page (without cookie banner) to users who have already provided their consent
  • It detects bots/spiders and serves them a clean page
  • It supports the auto-assignment of categories when blocking scripts
  • It supports AMP pages
  • AdRoll
  • AddThis widgets
  • Bing
  • CodePen
  • Criteo
  • Disqus
  • Elevio
  • Facebook Comments
  • Facebook widgets
  • Freshchat
  • Google AdSense
  • Google Analytics
  • Google Maps
  • Google ReCaptcha
  • Google Site Search
  • Google Tag Manager
  • Google oAuth
  • Google+ widgets
  • Headway
  • Instagram widgets
  • Kissmetrics
  • LinkedIn widgets
  • Mixpanel
  • Neodata
  • Olark
  • Optimizely
  • Outbrain
  • PayPal widgets
  • Pingdom
  • Pinterest widgets
  • Segment
  • ShareThis widgets
  • Twitter widgets
  • UserVoice
  • Vimeo
  • YouTube


  • Download the plugin from the WordPress plugin repository. Access the administration panel within WordPress and click on Plugins > Add New Plugin > Cookie Solution. Then install and activate it.
  • Once it’s been installed, access the Settings panel where you’ll be asked to fill in the script that was generated in your iubenda account when you activated the cookie policy and the iubenda Cookie Solution (if you haven’t please do so now). For more information on how to activate our cookie management solution, consult this guide.


Once configured, the plugin will begin to show the banner on which your cookie policy will be shown/linked to users that visit your site for the first time without the need for any other further configurations. Our WP plugin will also recognize and automatically detect and block the cookies indicated in the above block-list, that are present on your site.


Our WordPress plugin automatically blocks scripts that are generated on the server side (therefore returned by PHP by WordPress). Scripts that are inserted into the page via JavaScript after the loading process of that page are not and cannot be blocked automatically.

These scripts can be blocked by entering the source into the Custom Script boxes in the plugin console or by using the manual wrapping method illustrated in the example below and (in more detail) in this help post

Blocking custom scripts from within the console

The Custom Scripts field makes it easy for you to block scripts inserted into the page directly from within the plugin console. This greatly reduces the need for direct edits to the site’s code.

Here’s how to do it:

  • In the left menu within your administration panel click on iubenda Cookie Solution.
  • Next, scroll down to find the Custom scripts and Custom iframes fields near the center of the page.Wordpress custom and iframe scripts fields
  • Enter your script or iframe sources as needed, assign their purpose (optional) and click the Save Changes button at the bottom-left of the page.

Usage Examples

Using these fields are pretty straightforward. Simply enter the script or iframe src attribute you’d like to block.


If you wanted to block a social button (which inserts scripts into the page via JavaScript), you’d simply need to enter the script source, e.g. connect.socialwebsite.net/en_US/track.js into the scripts field.


Let’s say you wanted to block scripts inserted into the page via the following iframe

<iframe width="1280" height="720" src="https://www.videowebsite.com/embed/xxFhMChxx" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

What you’ll need to enter into the iframe field would be videowebsite.com/embed/ as this is the actual source of the scripts. Be careful NOT to enter the component id (videowebsite.com/embed/xxFhMChxx) to ensure that all scripts coming from the actual source are blocked.

Manual Use (wrapping method)

This method requires you to directly modify your site’s code. You’ll need to go into the relevant section of your site’s code and add the scripts to be blocked as explained below.

For example a conversion pixel for Google Ads would be handled this way:

<script type="text/javascript">
    /* <![CDATA[ */
    var google_conversion_id =CONVERSION_ID;
    var google_conversion_label = "CONVERSION-LABEL";
    var google_custom_params = window.google_tag_params;
    var google_remarketing_only = true;
    /* ]]> */
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
    <div style="display:inline;">
        <img height="1" width="1" style="border-style:none;" alt="" src="//googleads.g.doubleclick.net/pagead/viewthroughconversion/1030205862/?value=0&amp;guid=ON&amp;script=0"/>

If you’ve enabled the per-category consent feature you’ll need to assign the purpose. Resuming the previous example, being part of the “Targeting & Advertising” purpose (id 5):

      <script type="text/javascript">
      <script type="text/javascript" src="..."></script>

If there are HTML / IMG / IFRAME elements, you will need to do it this way:

      <iframe src="...
      <img src="...

To stop automatic parsing/replacing the iframe/scripts that contain a defined src:

      <script type="text/javascript">...</script>

Shortcodes are available for elements installed directly within WordPress posts (as opposed to elements integrated at the template level – example footer.php):


iubenda and Google AMP – How to collect cookie consent in WordPress

If you’re using or planning to use Google’s Accelerated Mobile Pages (AMP) to load your web pages faster on mobile, you might be wondering how to set up your WordPress site in a way that allows you to collect cookie consent and avoid penalties. It requires some work, but luckily, iubenda can help: in fact, our Cookie and Consent Solution plugin for WordPress is fully compatible with AMP.

For a step-by-step guide (complete with sample codes, a demo and WordPress tips) and more information on how to block cookies before user consent on AMP, read How to integrate iubenda Cookie Solution with Google AMP (WordPress method included).

AMP and “templates” folder permissions

You’ve enabled the Google AMP support, but got an error message when you auto-generate the AMP configuration file? The cause is a problem with the “templates” folder permissions. Here’s how to fix it:

  1. Through your FTP client, enter the (previously uploaded) “iubenda-cookie-law-solution” folder and create (if missing) a subfolder called “templates” Templates folder (iubenda WordPress plugin)
  2. Set 664 permissions for the “templates” folder (the “Get info/Edit permissions” option is usually available via right click) Templates folder permissions (iubenda WordPress plugin)
  3. Repeat the “Google AMP support” enable procedure and save Google AMP support options (iubenda WordPress plugin)

Further information

For API calls and xmlrpc we suggest the following parameter ?iub_no_parse=1: this will place the iubenda script in a disactivated state and therefore avoids all parsing/replacing operations.

We often provide updated versions of our plugin which are unstable during the testing phase as Beta versions are.

To install a Beta version of the plugin, the first thing to do is install an external plugin called “WP Rollback”, which allows you to select an unofficial version of our plugin.

WP Rollback installation

Please note: WP Rollback requires a WordPress version above 4.0.

As for other plugins, you can install WP Rollback by accessing the Plugin area in your WordPress admin panel and clicking on “Add new”; from here you can search for “WP Rollback” and install it.

After the installation and activation, it will be necessary to go back to the page in which all the installed plugins are listed. Here you’ll notice that “Rollback” will have appeared next to every entry.

All that needs to be done now is to look for the “iubenda Cookie Solution” plugin and click on the “Rollback” entry. Here you’ll find all the different versions of the plugin; the version currently in use will be labelled “installed version”, while the Beta versions will be labeled as such.

To install and test the Beta version of the plugin, simply click on the Beta entry you wish to use. This will cause the current version of the Plugin to be overwritten by the Beta version; to revert the process, the same process will have to be undertaken, the difference being the selecting of the previous stable version and not the Beta one.

How to signal a bug or request support

To signal a bug please email us and provide a clear and detailed description of the problem.

It’s always useful to attach the debug information provided by WordPress along with your request for support. To access the debug information, you must open the WordPress installation folder and look for the file named wp-config.php.

Once inside, please look for the following line:

define('WP_DEBUG', false);

Modify it to:

define('WP_DEBUG', true);

Once the file saved, open a page on your WordPress and the debug information will start to appear. Keep our plugin active and send us any errors or messages shown by WordPress.

All-in-One Cookie and Consent Solution

Download the WordPress plugin

Read the changelog

See also