Extend register_widget to allow passing params as second argument
|Reported by:||codearachnid||Owned by:||codearachnid|
I ran into an issue recently where I needed to make multiple calls of register_widget('my_custom_class'); on the same class and have multiple unique widgets registered.
The problem I ran into is that every time the same class is called it will overwrite the last instance of the same class during the widget constructor request parent::__construct('unique_id', 'widget title'); This does not allow for reuse of the same class to instantiate multiple widgets. I found that if I were to extend the register method in WP_Widget_Factory to pass through arguments into the extended WP_Widget constructor that I can reuse the same class for multiple widget registations. I am working out the logic to implement this directly into /wp-includes/widgets.php for future functionality improvement.
Change History (10)
- Keywords needs-patch added
- Milestone changed from Awaiting Review to Future Release