Dynamic WordPress WP_Widget generator

Here is an example of generating multiple WP_Widget instances from an array.

This is available from WP 4.6.0 when it became possible to pass an instance of WP_Widget into register_widget();

Here is the sample widget array config:


And here are the generated widgets:



Code over here: https://github.com/dtbaker/dynamic-wordpress-widgets

Leave a Reply

Your email address will not be published.