Allow ability to pass parameters when registering widgets

  1. Timothy Wood


    I have run into an issue several times when calling register_widget( 'MyNewWidget' ); for a shared widget class it instantiates the widget over any previously called register_widget() calls to the same class. My proposal is to implement a change of the WP_Widget_Factory::register method to allow passing parameters thus allowing unique constructor calls when registering. My proposed change can be seen as an extension of the WP_Widget_Factory now: https://gist.github.com/2437027

    Posted: 3 years ago #
  2. Dieta Dukana

    I don't think many people have ran into the same problem as you Timothy, but I think that this is a good idea and would make wordpress better.

    Posted: 3 years ago #
  3. Wonder


    I do not think this is strictly required, I think wordpress developers will overlook.

    Posted: 3 years ago #
  4. Hello Timothy,
    first of all, excuse me for my bad english, i'm from Germany. I have to say that you problem is not too rare. But have you checked your code at this point?:
    Class Extend_WP_Widget_Factory extends WP_Widget_Factory {

    In the most cases the fault could be found here.

    I hope you can solve your problem!
    with best regards,
    Jens Zalando

    Posted: 3 years ago #
  5. Tien Nguyen

    This way is much better than, add your widget naturally into WordPress stream:

    global $wp_widget_factory;
    $wp_widget_factory->widgets[$id] = new WP_Custom_Widget($args);
    Posted: 1 week ago #

RSS feed for this topic


You must log in to post.

  • Rating

    4 Votes
  • Status

    This idea is under consideration