diff --git a/CHANGELOG.md b/CHANGELOG.md index b7ce6fd6e7624bdb1b229f51d63edcde873be2a6..c9386089ea1182eab0193062dc7dcfa2bc00ee28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [Unreleased] +### Changed +- Usage tracker is initialized by the library after all plugin's hookables are registered. + ## [1.1.0] - 2022-11-23 ### Added - Compatibility with WooCommerce High-Performance Order Storage (HPOS) diff --git a/src/Initialization/Simple/SimpleFreeStrategy.php b/src/Initialization/Simple/SimpleFreeStrategy.php index 11c376f258519e26eab0520657e0e4fe5bb13a56..5927a1b816fcab5d19fb5a5b8a95e44869910b72 100644 --- a/src/Initialization/Simple/SimpleFreeStrategy.php +++ b/src/Initialization/Simple/SimpleFreeStrategy.php @@ -52,6 +52,9 @@ class SimpleFreeStrategy implements InitializationStrategy { $this->store_plugin( $this->plugin ); $this->init_plugin( $this->plugin ); + // Flush usage tracker late, to remain backward compatible with plugins which could instantiate + // the tracker on their own through `wpdesk_tracker_instance` filter. + $this->get_tracker_instance(); return $this->plugin; } diff --git a/src/Initialization/Simple/SimplePaidStrategy.php b/src/Initialization/Simple/SimplePaidStrategy.php index e4fe8693428b12e6980ca69a3a1c7513763a8860..df7fd1c16b5ced65753be912427e8d607e4fdaf0 100644 --- a/src/Initialization/Simple/SimplePaidStrategy.php +++ b/src/Initialization/Simple/SimplePaidStrategy.php @@ -65,6 +65,9 @@ class SimplePaidStrategy implements InitializationStrategy { } $this->store_plugin( $this->plugin ); $this->init_plugin( $this->plugin ); + // Flush usage tracker late, to remain backward compatible with plugins which could instantiate + // the tracker on their own through `wpdesk_tracker_instance` filter. + $this->get_tracker_instance(); }, $priority_before_flow_2_5_after_2_6 = -45); return $this->plugin;