WordPress.org

Ready to get started?Download WordPress

Forums

How to get Widget ID in Widget Instance (1 post)

  1. geilt
    Member
    Posted 2 years ago #

    This is in response to: http://wordpress.org/support/topic/how-ca-i-get-widget-id?replies=14 which is closed.

    $widget_class = explode( $args['widget_id'] );

    $widget_id = $widget_class[ count($widget_class) - 1];

    $widget_array = get_option('widget_nameofyourwidget');

    $widget_array[$widget_id] = $instance;

    update_option('widget_nameofyourwidget', $widget_array);

    This allows you to update Widget Options for an instance of a Widget, inside the Widget Function in the Widget class.

Topic Closed

This topic has been closed to new replies.

About this Topic