here.',
+ 'plausible-analytics'
+ ),
+ 'post'
+ ),
+ admin_url( 'index.php?page=plausible_analytics_statistics' )
+ );
+ }
+ }
+
/**
* Modifies "Enable proxy enabled" to "Proxy enabled", etc.
*
@@ -63,66 +85,37 @@ public function maybe_modify_success_message( $message, $option_name, $status )
}
/**
- * Renders the warning for the Enable Proxy option.
+ * Display missing Plugin Token warning.
*
- * @since 1.3.0
* @output HTML
*/
- public function proxy_warning() {
- if ( ! empty( Helpers::get_settings()[ 'self_hosted_domain' ] ) ) {
- $this->option_na_in_ce();
- } else {
- echo sprintf(
- wp_kses(
- // translators: %s: URL to Plausible contact page.
- __(
- 'After enabling this option, please check your Plausible dashboard to make sure stats are being recorded. Are stats not being recorded? Do
reach out to us. We\'re here to help!',
- 'plausible-analytics'
- ),
- 'post'
+ public function missing_api_token_warning() {
+ echo sprintf(
+ wp_kses(
+ __(
+ 'Please
create a Plugin Token and insert it into the Plugin Token field above.',
+ 'plausible-analytics'
),
- 'https://plausible.io/contact'
- );
- }
+ 'post'
+ )
+ );
}
/**
- * Show notice when Plugin Token notice is disabled.
+ * Display option disabled by a missing Plugin Token warning.
*
* @output HTML
*/
- public function option_na_in_ce() {
+ public function option_disabled_by_missing_api_token() {
echo wp_kses(
__(
- 'This feature is not available in Plausible Community Edition.',
+ 'Please
create a Plugin Token and insert it into the Plugin Token field above to enable this option.',
'plausible-analytics'
),
'post'
);
}
- /**
- * Renders the analytics dashboard link if the option is enabled.
- *
- * @since 2.0.0
- * @output HTML
- */
- public function enable_analytics_dashboard_notice() {
- if ( ! empty( Helpers::get_settings()[ 'enable_analytics_dashboard' ] ) ) {
- echo sprintf(
- wp_kses(
- // translators: %s: URL to the analytics dashboard.
- __(
- 'Your analytics dashboard is available
here.',
- 'plausible-analytics'
- ),
- 'post'
- ),
- admin_url( 'index.php?page=plausible_analytics_statistics' )
- );
- }
- }
-
/**
* Renders the Self-hosted warning if the Proxy is enabled.
*
@@ -142,34 +135,37 @@ public function option_disabled_by_proxy() {
}
/**
- * Display missing Plugin Token warning.
+ * Show a notice when the Plugin Token notice is disabled.
*
* @output HTML
*/
- public function missing_api_token_warning() {
- echo sprintf(
- wp_kses(
- __(
- 'Please
create a Plugin Token and insert it into the Plugin Token field above.',
- 'plausible-analytics'
- ),
- 'post'
- )
+ public function option_na_in_ce() {
+ echo wp_kses(
+ __(
+ 'This feature is not available in Plausible Community Edition.',
+ 'plausible-analytics'
+ ),
+ 'post'
);
}
/**
- * Display option disabled by missing Plugin Token warning.
+ * Renders the warning for the Enable Proxy option.
*
+ * @since 1.3.0
* @output HTML
*/
- public function option_disabled_by_missing_api_token() {
- echo wp_kses(
- __(
- 'Please
create a Plugin Token and insert it into the Plugin Token field above to enable this option.',
- 'plausible-analytics'
+ public function proxy_warning() {
+ echo sprintf(
+ wp_kses(
+ // translators: %s: URL to Plausible contact page.
+ __(
+ 'After enabling this option, please check your Plausible dashboard to make sure stats are being recorded. Are stats not being recorded? Do
reach out to us. We\'re here to help!',
+ 'plausible-analytics'
+ ),
+ 'post'
),
- 'post'
+ 'https://plausible.io/contact'
);
}
}
diff --git a/src/Admin/Settings/Page.php b/src/Admin/Settings/Page.php
index 169d4526..1ea42480 100644
--- a/src/Admin/Settings/Page.php
+++ b/src/Admin/Settings/Page.php
@@ -137,20 +137,6 @@ public function __construct() {
'value' => EnhancedMeasurements::OUTBOUND_LINKS,
'caps' => [ Capabilities::GOALS ],
],
- EnhancedMeasurements::ECOMMERCE_REVENUE => [
- 'label' => esc_html__( 'Ecommerce revenue', 'plausible-analytics' ),
- 'docs' => 'https://plausible.io/docs/wordpress-integration#track-ecommerce-revenue',
- 'slug' => 'enhanced_measurements',
- 'type' => 'checkbox',
- 'value' => EnhancedMeasurements::ECOMMERCE_REVENUE,
- 'caps' => [
- Capabilities::GOALS,
- Capabilities::FUNNELS,
- Capabilities::PROPS,
- Capabilities::REVENUE,
- ],
- 'disabled' => ! empty( $settings['self_hosted_domain'] ),
- ],
EnhancedMeasurements::PAGEVIEW_PROPS => [
'label' => esc_html__( 'Authors and categories', 'plausible-analytics' ),
'docs' => 'https://plausible.io/docs/wordpress-integration#authors-and-categories',
@@ -159,6 +145,21 @@ public function __construct() {
'value' => EnhancedMeasurements::PAGEVIEW_PROPS,
'caps' => [ Capabilities::PROPS ],
],
+ EnhancedMeasurements::ECOMMERCE_REVENUE => [
+ 'label' => esc_html__( 'Ecommerce revenue', 'plausible-analytics' ),
+ 'docs' => 'https://plausible.io/docs/wordpress-integration#track-ecommerce-revenue',
+ 'slug' => 'enhanced_measurements',
+ 'type' => 'checkbox',
+ 'value' => EnhancedMeasurements::ECOMMERCE_REVENUE,
+ 'caps' => [
+ Capabilities::GOALS,
+ Capabilities::FUNNELS,
+ Capabilities::PROPS,
+ Capabilities::REVENUE,
+ ],
+ 'disabled' => ! empty( $settings['self_hosted_domain'] ),
+ 'disabled_tooltip' => self::OPTION_NOT_AVAILABLE_IN_CE_HOOK,
+ ],
EnhancedMeasurements::FORM_COMPLETIONS => [
'label' => esc_html__( 'Form completions', 'plausible-analytics' ),
'docs' => 'https://plausible.io/docs/wordpress-integration#form-completions',
@@ -258,11 +259,12 @@ public function __construct() {
),
'fields' => [
[
- 'label' => esc_html__( 'Enable proxy', 'plausible-analytics' ),
- 'slug' => 'proxy_enabled',
- 'type' => 'checkbox',
- 'value' => 'on',
- 'disabled' => ! empty( Helpers::get_settings()['self_hosted_domain'] ),
+ 'label' => esc_html__( 'Enable proxy', 'plausible-analytics' ),
+ 'slug' => 'proxy_enabled',
+ 'type' => 'checkbox',
+ 'value' => 'on',
+ 'disabled' => ! empty( Helpers::get_settings()['self_hosted_domain'] ),
+ 'disabled_tooltip' => self::OPTION_NOT_AVAILABLE_IN_CE_HOOK,
],
],
],
@@ -432,23 +434,12 @@ public function __construct() {
],
];
- /**
- * If the self-hosted domain setting has a value, add an "option disabled" notice to the Ecommerce Revenue toggle.
- */
- if ( ! empty( $settings['self_hosted_domain'] ) ) {
- $fields = $this->fields['general'][1]['fields'];
-
- array_splice( $fields, 4, 0, self::OPTION_NOT_AVAILABLE_IN_CE_HOOK );
-
- $this->fields['general'][1]['fields'] = $fields;
- }
-
/**
* If the proxy is enabled, or the self-hosted domain option has a value, display a warning box.
*
* @see self::proxy_warning()
*/
- if ( Helpers::proxy_enabled() || ! empty( $settings['self_hosted_domain'] ) ) {
+ if ( Helpers::proxy_enabled() && ! empty( $settings['self_hosted_domain'] ) ) {
$this->fields['general'][4]['fields'][] = self::PROXY_WARNING_HOOK;
}
@@ -515,7 +506,7 @@ private function init() {
add_action( 'in_admin_header', [ $this, 'add_background_color' ] );
/**
- * Hooks that run on settings page.
+ * Hooks that run on the settings page.
*/
new Hooks();
}
From d1812f95c48e7a9ece062e3a5c6dd4727c6335f0 Mon Sep 17 00:00:00 2001
From: Daan van den Bergh <18595395+Dan0sz@users.noreply.github.com>
Date: Wed, 8 Jul 2026 15:06:24 +0200
Subject: [PATCH 31/35] Removed: Stray > inside the class attribute.
---
src/Admin/Settings/API.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Admin/Settings/API.php b/src/Admin/Settings/API.php
index cc03e2e4..5e81361d 100644
--- a/src/Admin/Settings/API.php
+++ b/src/Admin/Settings/API.php
@@ -143,7 +143,7 @@ class="w-5 h-12 text-yellow-400">
-
From f85c715b8dc9a985b142449d58f1100569ebb74d Mon Sep 17 00:00:00 2001
From: Daan van den Bergh <18595395+Dan0sz@users.noreply.github.com>
Date: Wed, 8 Jul 2026 15:07:12 +0200
Subject: [PATCH 32/35] Improved: Use the canonical role value for the disabled
Administrator check.
---
src/Admin/Settings/API.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Admin/Settings/API.php b/src/Admin/Settings/API.php
index 5e81361d..89f1cc31 100644
--- a/src/Admin/Settings/API.php
+++ b/src/Admin/Settings/API.php
@@ -59,7 +59,7 @@ public function render_checkbox_field( array $field, $is_list = false ) {
( is_array( $slug ) ? checked( $value, in_array( $value, $slug, false ) ? $value : false, false ) : checked( $value, $slug, false ) );
$disabled = ! empty( $field['disabled'] ) ? 'disabled' : '';
$show_disabled_tooltip = $disabled && ! empty( $field['disabled_tooltip'] );
- $check_when_disabled = $id === 'expand_dashboard_access_administrator';
+ $check_when_disabled = $field['slug'] === 'expand_dashboard_access' && $value === 'administrator';
$caps = ! empty( $field['caps'] ) ? $field['caps'] : [];
$addtl_opts = ! empty( $field['addtl_opts'] );
?>
From f9097d80c818797c98eb5ac611ccc596be1a42ab Mon Sep 17 00:00:00 2001
From: Daan van den Bergh <18595395+Dan0sz@users.noreply.github.com>
Date: Wed, 8 Jul 2026 15:08:52 +0200
Subject: [PATCH 33/35] Fixed: Unused loop variable $callback_data.
---
tests/TestCase.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/TestCase.php b/tests/TestCase.php
index 1e72aa31..fc415bbd 100644
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -215,7 +215,7 @@ public function removeAction( $hook, $callback, $priority = 10 ) {
$callbacks = $wp_filter[ $hook ]->callbacks ?? [];
$callbacks = $callbacks[ $priority ] ?? [];
- foreach ( $callbacks as $callback_key => $callback_data ) {
+ foreach ( array_keys( $callbacks ) as $callback_key ) {
if ( str_contains( $callback_key, $callback ) ) {
unset( $wp_filter[ $hook ]->callbacks[ $priority ][ $callback_key ] );
}
From dc915ef60b339511efda57935d33988384698d3c Mon Sep 17 00:00:00 2001
From: Daan van den Bergh <18595395+Dan0sz@users.noreply.github.com>
Date: Wed, 8 Jul 2026 15:09:01 +0200
Subject: [PATCH 34/35] PHPDoc: Missing @param for $settings.
---
src/Helpers.php | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/Helpers.php b/src/Helpers.php
index 018ba143..5c2a6f8a 100644
--- a/src/Helpers.php
+++ b/src/Helpers.php
@@ -427,6 +427,8 @@ public static function get_user_role() {
/**
* Wrapper to check if the Cloaked Affiliate Links option contains any values.
*
+ * @param array $settings Allows passing a current settings object.
+ *
* @return bool
*/
public static function is_cloaked_affiliate_links_enabled( $settings = [] ) {
From d2d31a105b41f7b41b1b056a20c6b55042479831 Mon Sep 17 00:00:00 2001
From: Daan van den Bergh <18595395+Dan0sz@users.noreply.github.com>
Date: Wed, 8 Jul 2026 15:12:57 +0200
Subject: [PATCH 35/35] =?UTF-8?q?Improved:=20Make=20the=20key=E2=86=92opti?=
=?UTF-8?q?on=20mapping=20explicit?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Admin/Provisioning.php | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/Admin/Provisioning.php b/src/Admin/Provisioning.php
index 5c04c6f1..bbfde3b2 100644
--- a/src/Admin/Provisioning.php
+++ b/src/Admin/Provisioning.php
@@ -37,6 +37,14 @@ class Provisioning {
'variation_id',
];
+ /**
+ * Map Enhanced Measurement keys to their respective setting key.
+ */
+ private const MEASUREMENT_TO_SETTING_MAP = [
+ EnhancedMeasurements::CLOAKED_AFFILIATE_LINKS => 'affiliate_links',
+ EnhancedMeasurements::QUERY_PARAMS => 'query_params',
+ ];
+
/**
* @var bool
*/
@@ -365,9 +373,9 @@ public function maybe_delete_goals( $old_settings, $settings ) {
*/
private function maybe_add( $keys, $settings, $enhanced_measurements ) {
foreach ( $keys as $key ) {
- $option_name = str_replace( '-', '_', $key );
+ $option_name = self::MEASUREMENT_TO_SETTING_MAP[ $key ] ?? '';
- if ( Helpers::setting_has_values( $settings, $option_name ) ) {
+ if ( ! empty( $option_name ) && Helpers::setting_has_values( $settings, $option_name ) ) {
$enhanced_measurements[] = $key;
}
}