Title: Autoactivate widget after plugin activation
Last modified: May 12, 2019

---

# Autoactivate widget after plugin activation

 *  Resolved [webvd](https://wordpress.org/support/users/webvd/)
 * (@webvd)
 * [7 years ago](https://wordpress.org/support/topic/autoactivate-widget-after-plugin-activation/)
 * Hi,
 * I’m using your plugin in my theme and would like to activate the testimonal slider
   widget after the plugin is installed and activated by default. I use the code
   underneath but for some reason the whole WordPress installation gets broken after
   the plugin is activated. Also, I first have to click next in the box that appears
   for live connection. When I put back the code after this the activation works.
 * Any idea how to pass this or how to see if this boxed is passed and then let 
   the code does his thing?
 *     ```
       /**
        * Activate Siteorigin Livemesh widget after import
        */
   
       if ( is_plugin_active( 'livemesh-siteorigin-widgets/livemesh-siteorigin-widgets.php' ) ) {
   
       $folder = WP_PLUGIN_DIR . '/livemesh-siteorigin-widgets/includes/widgets/';
       $widget_ids = array('lsow-testimonials-slider-widget');
       foreach ($widget_ids as $widget_id) {
   
       	if( !file_exists($folder . $widget_id . '/' . $widget_id . '.php') ) continue;
   
       		wp_cache_delete( 'siteorigin_widgets_active', 'options' );
       		$active_widgets = SiteOrigin_Widgets_Bundle::single()->get_active_widgets();
       		$active_widgets[$widget_id] = true;
       		update_option( 'siteorigin_widgets_active', $active_widgets );
       		wp_cache_delete( 'active_widgets', 'siteorigin_widgets' );
       }
   
       } 
       ```
   
 * **Overall such a nice plugin.**
    Regards 🙂

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [livemesh](https://wordpress.org/support/users/livemesh/)
 * (@livemesh)
 * [7 years ago](https://wordpress.org/support/topic/autoactivate-widget-after-plugin-activation/#post-11526656)
 * Can you pls post this in the siteorigin widgets bundle forum or the community
   forum at siteorigin.com? I am not fully aware of how the widgets bundle works
   internally and they should be able to help quicker than we are able to. Thank
   you!
 *  Thread Starter [webvd](https://wordpress.org/support/users/webvd/)
 * (@webvd)
 * [7 years ago](https://wordpress.org/support/topic/autoactivate-widget-after-plugin-activation/#post-11527070)
 * I will, thanks.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Autoactivate widget after plugin activation’ is closed to new replies.

 * ![](https://ps.w.org/livemesh-siteorigin-widgets/assets/icon-256x256.png?rev=
   1902362)
 * [Livemesh SiteOrigin Widgets](https://wordpress.org/plugins/livemesh-siteorigin-widgets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/livemesh-siteorigin-widgets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/livemesh-siteorigin-widgets/)
 * [Active Topics](https://wordpress.org/support/plugin/livemesh-siteorigin-widgets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/livemesh-siteorigin-widgets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/livemesh-siteorigin-widgets/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [webvd](https://wordpress.org/support/users/webvd/)
 * Last activity: [7 years ago](https://wordpress.org/support/topic/autoactivate-widget-after-plugin-activation/#post-11527070)
 * Status: resolved