Skip to main content
Introducing packages.sweber.dev
All posts
Release2 min read

Permito Pro 0.9.0: a WordPress plugin that blocks scripts by handle

Permito Pro 0.9.0 adds permito-wordpress: one JSON file becomes a WordPress plugin with the Permito banner, blocking of scripts that other plugins enqueue, and shortcodes for the settings link and the cookie table. It works for WooCommerce too.

By Seya Weber

Permito Pro 0.9.0 is out on GitHub Packages. The new package @weber-development/permito-wordpress brings Permito to WordPress without writing PHP.

The problem it solves

A banner on a WordPress site is the easy part. The hard part is that analytics, pixels and chat widgets are loaded by other plugins, and they run before the visitor decided. The free script tag build can only block what you change yourself.

One file, one plugin

npx permito-wordpress build --config permito-site.json --out dist

The JSON file has the normal Permito config plus a map from script handles to consent categories, for example "woocommerce-google-analytics-integration": "statistics". The command writes a plugin folder you zip and upload under Plugins. The plugin:

  • prints the config and loads the banner in the head, before other scripts
  • blocks every script that is enqueued under a listed handle, together with the inline parts WordPress prints for it (wp_localize_script, wp_add_inline_script, WordPress 6.3 or later), and lets Permito run them after consent
  • adds the shortcodes [permito_settings_link] and [permito_cookie_table] for the table generated by permito-cookie-table
  • lists the handles of a page when an administrator opens it with ?permito_debug=1, so you know what to put in the map

WooCommerce works the same way, because WooCommerce extensions enqueue their scripts through WordPress.

What it does not do

Scripts that a plugin prints directly into the page, without wp_enqueue_script, cannot be blocked from outside. The README says so and suggests to load them through WordPress or switch them off. There is no settings screen: the configuration is the file you build. Shopware has no adapter yet.

We tested the plugin with plain PHP (the gating functions and the hook wiring against stand-ins for the WordPress functions), not inside a WordPress installation. Try it on a staging site and check the network tab in a private window before accepting.

Upgrade

pnpm add -D @weber-development/permito-wordpress@^0.9.0

The other Pro packages share the version number and move together to 0.9.0. Permito Pro stays below 1.0 for now.

Permito is technical consent infrastructure, not legal advice.

Package in this post

Permito

Self-hosted cookie banner, preference center and consent gates for React, Next.js and any site via a script tag. No network calls, no tracking, no dark patterns.

pnpm add @permitojs/core @permitojs/react
View package

Related posts