Key takeaways
- Install the Trusted Cookie plugin, paste your install code, and the banner appears on every page.
- The plugin puts the script first in the <head>, so you never edit your theme.
- It keeps caching plugins such as WP Rocket and LiteSpeed Cache from delaying the script.
- It passes every choice to the WP Consent API, so other plugins can follow it.
Before you start
You need WordPress 6.0 or newer and PHP 7.4 or newer. If another cookie banner plugin is active, deactivate it, or visitors see two banners.
Install the plugin
- Create a free Trusted Cookie account and add your website.
- In the dashboard, open your site's Settings, choose the WordPress tab, and download the plugin.
- In WordPress, go to Plugins, Add New, Upload Plugin. Upload the zip file and activate it.
- Back in the dashboard, copy your install code.
- In the WordPress sidebar, open Trusted Cookie, paste the code and save. The status shows Connected.
The plugin has no banner settings of its own. Change the banner in your dashboard and your site picks it up within a minute.
What the plugin does for you
- Adds the install code as the first tag in the <head> of every page.
- Keeps LiteSpeed Cache, WP Rocket, Autoptimize and Cloudflare Rocket Loader from delaying the script.
- Holds back scripts you choose by their WordPress handle until visitors agree.
- Passes every choice to the WP Consent API, so plugins that read it follow your visitors' choices.
- Adds a cookie settings button with the shortcode [trust_cookie_settings], or with any link to #cookie-settings.
For developers
- postghost_consent_should_load (filter, bool): turn the script off on some pages.
- postghost_consent_script_categories (filter, handle => category): hold back more scripts by handle.
Questions
Does it work with WooCommerce?
Yes. WooCommerce runs on WordPress, so the plugin adds the banner to every shop page. Payment providers' scripts are not held back.
Can I add the tag without the plugin?
Yes. Add the install tag to your theme's header.php right after <head>, or with a header-scripts plugin. The plugin is easier and handles caching plugins for you.