Support » Fixing WordPress » How to get Widget ID in Widget Instance

  • This is in response to: 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.

  • The topic ‘How to get Widget ID in Widget Instance’ is closed to new replies.