From 93c5c4e9b77bbf41114cbf952ff677858b531917 Mon Sep 17 00:00:00 2001 From: Dan0sz <18595395+Dan0sz@users.noreply.github.com> Date: Tue, 2 Dec 2025 18:39:50 +0100 Subject: [PATCH 1/2] Fixed: call to undefined function get_plugin_data --- src/Actions.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Actions.php b/src/Actions.php index 74deef3..be2a78a 100644 --- a/src/Actions.php +++ b/src/Actions.php @@ -40,6 +40,10 @@ public function maybe_insert_version_meta_tag() { * Retrieves the plugin's current version. */ private function get_plugin_version() { + if ( ! function_exists( 'get_plugin_data' ) ) { + require_once ABSPATH . 'wp-admin/includes/plugin.php'; + } + static $data = null; if ( $data === null ) { From 0a0d177f7a0a34f09e587c978a1cfa0d8e670eef Mon Sep 17 00:00:00 2001 From: Dan0sz <18595395+Dan0sz@users.noreply.github.com> Date: Tue, 2 Dec 2025 18:41:11 +0100 Subject: [PATCH 2/2] Improved: only include plugin.php when running tests. --- src/Actions.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Actions.php b/src/Actions.php index be2a78a..cd4f759 100644 --- a/src/Actions.php +++ b/src/Actions.php @@ -28,10 +28,15 @@ public function __construct() { * @return void */ public function maybe_insert_version_meta_tag() { - $version = $this->get_plugin_version(); $running_tests = array_key_exists( 'plausible_verification', $_GET ); - if ( $version && $running_tests ) { + if ( ! $running_tests ) { + return; + } + + $version = $this->get_plugin_version(); + + if ( $version ) { echo "\n"; } } @@ -43,7 +48,7 @@ private function get_plugin_version() { if ( ! function_exists( 'get_plugin_data' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } - + static $data = null; if ( $data === null ) {