Title: Theme install inactivate widgets
Last modified: August 20, 2016

---

# Theme install inactivate widgets

 *  [Versipellis](https://wordpress.org/support/users/versipellis/)
 * (@versipellis)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/theme-install-inactivate-widgets/)
 * What I want to do for a theme I am making is that on install of the theme, move
   an active widget into inactive.
 * I’ve a search bar at the top of my theme, and therefore do not want it in my 
   sidebar as default. However wordpress puts it there, is there a way to inactivate
   the search bar from the widget section. I assume it would be something I need
   to put in my functions.php.
 * Is this possible?
 * Thanks,
 * Versi

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

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/theme-install-inactivate-widgets/#post-3106394)
 * Widgets are stored on a per-theme basis, so your newly installed theme won’t 
   have any active widgets to move anywhere.
 *  Thread Starter [Versipellis](https://wordpress.org/support/users/versipellis/)
 * (@versipellis)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/theme-install-inactivate-widgets/#post-3106398)
 * When I started making this theme, I took a copy of twenty eleven as I usually
   do and started editing.
 * Three widgets, search, pages and meta, were automatically put in.
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/theme-install-inactivate-widgets/#post-3106410)
 * Try looking in sidebar.php. That’s the default sidebar content – not added widgets.
 *  Thread Starter [Versipellis](https://wordpress.org/support/users/versipellis/)
 * (@versipellis)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/theme-install-inactivate-widgets/#post-3106414)
 * Well I’ve looked there, which just says it loads ‘sidebar-1’ if Dynamic.
 * Sidebar 1 in my functions.php is as follows:
 *     ```
       register_sidebar( array(
       		'name' => __( 'Sidebar', 'twentyeleven' ),
       		'id' => 'sidebar-1',
       		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
       		'after_widget' => "</aside>",
       		'before_title' => '<h3 class="widget-title">',
       		'after_title' => '</h3>',
       	) );
       ```
   
 * As far as I can see that is not automatically putting in search, pages and meta
   widgets into the back end?
 * Also you stated:
 * > Widgets are stored on a per-theme basis, so your newly installed theme won’t
   > have any active widgets to move anywhere.
 * But I always find that installing wordpress puts in those same three widgets 
   with twenty eleven, then if I change theme they always stay no matter how many
   themes I test with.
 * I know code to completely unregister a widget, but thats not what I want.
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/theme-install-inactivate-widgets/#post-3106415)
 * Look again.
 *     ```
       <?php if ( ! dynamic_sidebar( 'sidebar-1' ) ) : ?>
   
       	<aside id="archives" class="widget">
       		<h3 class="widget-title"><?php _e( 'Archives', 'twentyeleven' ); ?></h3>
       		<ul>
       			<?php wp_get_archives( array( 'type' => 'monthly' ) ); ?>
       		</ul>
       	</aside>
   
       	<aside id="meta" class="widget">
       		<h3 class="widget-title"><?php _e( 'Meta', 'twentyeleven' ); ?></h3>
       		<ul>
       			<?php wp_register(); ?>
       			<li><?php wp_loginout(); ?></li>
       			<?php wp_meta(); ?>
       		</ul>
       	</aside>
   
       <?php endif; // end sidebar widget area ?>
       ```
   
 *  Thread Starter [Versipellis](https://wordpress.org/support/users/versipellis/)
 * (@versipellis)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/theme-install-inactivate-widgets/#post-3106416)
 * `<?php if ( ! dynamic_sidebar( 'sidebar-1' ) ) : ?>`
 * Thats stating, if Does Not Have Dynamic Sidebar ‘sidebar-1’ Display Following.
 * Thats what shows if you Do Not have any widgets in your sidebar in the backend.
 * Removing that will not do anything as, when the theme installs, there are already
   widgets active…
 * I want to force wordpress to inactivate all active widgets on install of my theme.
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/theme-install-inactivate-widgets/#post-3106419)
 * You theme will NOT have any active widgets. Widgets are stored on a PER THEME
   basis. Therefore, if this is a fresh install of a completely new theme, it will
   not have any widgets. This is even the case with child themes.
 *  Thread Starter [Versipellis](https://wordpress.org/support/users/versipellis/)
 * (@versipellis)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/theme-install-inactivate-widgets/#post-3106424)
 * Every time I install wordpress, it puts the twenty eleven theme in. With those
   widgets.
 * If I change theme, the widgets stay. This has happened on every single wordpress
   I have worked with, and I have several installs locally and several live websites.
 * Plus I cannot guarantee a user does not already have widgets activated, I cannot
   guarantee that they are using a fresh install.
 * Every new theme I install has the same widgets in that are put in prior to install.
   On any wordpress I have from 3.0 to the latest.
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/theme-install-inactivate-widgets/#post-3106434)
 * > it puts the twenty eleven theme in. With those widgets.
 * No – not widgets. Default sidebar content. This content is then removed if/when
   you add real widgets via Appearance -> Widgets. It is these “real” widgets that
   are then saved, in the database, but only for Twenty Eleven and no other theme.
 * > Plus I cannot guarantee a user does not already have widgets activated,
 * It doesn’t matter. If they switch to another theme, any previously active widgets
   will be automatically moved to Inactive by WordPress itself. They will not be
   activated again unless:
 * 1. The user adds them back manually
    or
 * 2. The user switches back to the old theme.
 *  Thread Starter [Versipellis](https://wordpress.org/support/users/versipellis/)
 * (@versipellis)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/theme-install-inactivate-widgets/#post-3106437)
 * Well how come when I install wordpress I automatically get these and more WIDGETS
   in my sidebar, and I have to go into the dashboard > appearance > widgets and
   they are sat there in the first of 5 sidebars. So I don’t see how you can say
   it is the default sidebar content when I have installed a vanilla wordpress today
   and there are plenty of WIDGETS in my BACKEND sidebar options.
 * So what you’ve said is completely wrong, if you change theme those WIDGETS stay
   I have tested this already today, and the WIDGETS are there on install of wordpress
   and the twenty eleven them. Tested today.

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

The topic ‘Theme install inactivate widgets’ is closed to new replies.

 * 10 replies
 * 2 participants
 * Last reply from: [Versipellis](https://wordpress.org/support/users/versipellis/)
 * Last activity: [13 years, 8 months ago](https://wordpress.org/support/topic/theme-install-inactivate-widgets/#post-3106437)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
