File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,10 +28,15 @@ public function __construct() {
2828 * @return void
2929 */
3030 public function maybe_insert_version_meta_tag () {
31- $ version = $ this ->get_plugin_version ();
3231 $ running_tests = array_key_exists ( 'plausible_verification ' , $ _GET );
3332
34- if ( $ version && $ running_tests ) {
33+ if ( ! $ running_tests ) {
34+ return ;
35+ }
36+
37+ $ version = $ this ->get_plugin_version ();
38+
39+ if ( $ version ) {
3540 echo "<meta name='plausible-analytics-version' content=' $ version' /> \n" ;
3641 }
3742 }
@@ -40,6 +45,10 @@ public function maybe_insert_version_meta_tag() {
4045 * Retrieves the plugin's current version.
4146 */
4247 private function get_plugin_version () {
48+ if ( ! function_exists ( 'get_plugin_data ' ) ) {
49+ require_once ABSPATH . 'wp-admin/includes/plugin.php ' ;
50+ }
51+
4352 static $ data = null ;
4453
4554 if ( $ data === null ) {
You can’t perform that action at this time.
0 commit comments