You've already forked wc-tier-and-package-prices
Release version 1.1.16 - Singleton pattern for settings page
Fixed persistent duplicate settings page rendering by implementing proper singleton pattern for admin class and caching settings instance. Fixes: - Settings page still appearing twice despite v1.1.15 fix - Multiple instantiation of WC_TPP_Admin class - Duplicate creation of WC_TPP_Settings instances Changes: - Implemented singleton pattern for WC_TPP_Admin class - Added private static $instance property with get_instance() method - Made WC_TPP_Admin constructor private - Added static $settings_instance property to cache settings page - Modified add_settings_page() to check and reuse cached settings instance - Changed instantiation from new WC_TPP_Admin() to WC_TPP_Admin::get_instance() Technical Details: - Ensures only one WC_TPP_Admin instance exists throughout plugin lifecycle - Prevents duplicate filter registrations even if woocommerce_get_settings_pages called multiple times - Settings page object created once and reused on subsequent filter calls - Follows WordPress/WooCommerce best practices for singleton implementation Updated Files: - includes/class-wc-tpp-admin.php (singleton pattern implementation) - wc-tier-and-package-prices.php (version 1.1.16) - composer.json (version 1.1.16) - CHANGELOG.md (v1.1.16 section) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
22
CHANGELOG.md
22
CHANGELOG.md
@@ -5,6 +5,28 @@ All notable changes to WooCommerce Tier and Package Prices will be documented in
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [1.1.16] - 2025-12-22
|
||||
|
||||
### Fixed
|
||||
|
||||
- Settings page still rendering twice in WooCommerce backend despite v1.1.15 fix
|
||||
- Multiple instantiation of WC_TPP_Admin and WC_TPP_Settings classes
|
||||
|
||||
### Changed
|
||||
|
||||
- Implemented singleton pattern for WC_TPP_Admin class with `get_instance()` method
|
||||
- Made WC_TPP_Admin constructor private to prevent direct instantiation
|
||||
- Added static caching of WC_TPP_Settings instance to prevent duplicate creation
|
||||
- Changed class instantiation from `new WC_TPP_Admin()` to `WC_TPP_Admin::get_instance()`
|
||||
|
||||
### Technical Details
|
||||
|
||||
- Added `private static $instance` property to WC_TPP_Admin class
|
||||
- Added `private static $settings_instance` property to cache settings page instance
|
||||
- Modified `add_settings_page()` to check and reuse cached settings instance
|
||||
- Ensures only one instance of each class exists throughout plugin lifecycle
|
||||
- Prevents duplicate filter registrations even if called multiple times
|
||||
|
||||
## [1.1.15] - 2025-12-22
|
||||
|
||||
### Fixed
|
||||
|
||||
Reference in New Issue
Block a user