Title: Removing Sidebars doesn&#039;t work in code
Last modified: August 21, 2016

---

# Removing Sidebars doesn't work in code

 *  Resolved [Remkus de Vries](https://wordpress.org/support/users/defries/)
 * (@defries)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/removing-sidebars-doesnt-work-in-code/)
 * For a specific lay-out I needed to remove the default Sidebar and add a specific
   one, one not defined in Simple Sidebars but in functions.php. Before the 2.0.
   x versions and Genesis 2.0.x all I had to do is unhook via the following code
 *     ```
       remove_action( 'genesis_sidebar', 'ss_do_sidebar' );
       remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
       add_action( 'genesis_sidebar', 'befrank_nieuwsbericht_sidebar' );
       /**
        * Replace default sidebar with news specific
        */
       function befrank_nieuwsbericht_sidebar() {
       	dynamic_sidebar( 'nieuwsbericht-sidebar' );
       }
       ```
   
 * but this doesn’t seem to work anymore. Any clue on why this happens? It just 
   outputs the default `genesis_do_sidebar`.
 * [http://wordpress.org/plugins/genesis-simple-sidebars/](http://wordpress.org/plugins/genesis-simple-sidebars/)

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

 *  Plugin Contributor [Ron Rennick](https://wordpress.org/support/users/wpmuguru/)
 * (@wpmuguru)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/removing-sidebars-doesnt-work-in-code/#post-4077765)
 * You are probably doing it too early. ss__do_sidebar is hooked in the get_header
   hook:
 * `add_action( 'get_header', 'ss_sidebars_init' );`
 *  Thread Starter [Remkus de Vries](https://wordpress.org/support/users/defries/)
 * (@defries)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/removing-sidebars-doesnt-work-in-code/#post-4077779)
 * Odd, this worked in the older versions just fine. Wrapped the remove inside a
   function and hooked in later. Works fine now. Thank Ron!
 *  [flamenco](https://wordpress.org/support/users/flamenco/)
 * (@flamenco)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/removing-sidebars-doesnt-work-in-code/#post-4077886)
 * Hi Ron,
    Interesting info, thanks. I ran into the same type of problem, but altering
   the timing didn’t fix it. I tracked it down…. silly Woo Commerce… as soon as 
   I disabled Genesis Connect for Woo Commerce, it started working again. I looked
   through its code, and found the smoking gun! So this is the command if you have
   Genesis Connect for Woo:
 * `remove_action( 'genesis_sidebar', 'gencwooc_ss_do_sidebar' );`
 * All these plugns pining for attention! 🙂 Maybe this will help someone else. 
   I may pop all this on my blog. 🙂
 * Cheers,
    Dave
 *  [Jon Brown](https://wordpress.org/support/users/jb510/)
 * (@jb510)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/removing-sidebars-doesnt-work-in-code/#post-4077887)
 * Thanks. Same problem… I usually hook layout changes to genesis_meta and couldn’t
   figure out why it wasn’t working after GSS was activated.
 * I’ll hook in late to get_header or to genesis_before_content_sidebar_wrap
 *  [Marcel Bootsman](https://wordpress.org/support/users/mbootsman/)
 * (@mbootsman)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/removing-sidebars-doesnt-work-in-code/#post-4077932)
 * I’d like to hook into this thread. Just to help others who might have the same
   problem.
 * Didn’t get it to work, but eventually I did.
 * The solution was to first remove the ss_sidebar and then the genesis_do_sidebar.
 * This code will remove the Primary sidebar:
 *     ```
       remove_action( 'genesis_sidebar', 'ss_do_sidebar' );
       remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
       ```
   
 * This code will not remove the Primary sidebar.
 *     ```
       remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
       remove_action( 'genesis_sidebar', 'ss_do_sidebar' );
       ```
   
 *  [flamenco](https://wordpress.org/support/users/flamenco/)
 * (@flamenco)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/removing-sidebars-doesnt-work-in-code/#post-4077933)
 * Marcel,
    That’s interesting… change the order to make it stick! 🙂
 * I did end up writing a short article to handle removal of sidebars when using
   Woo Commerce or Genesis Simple Sidebars.
    [http://davidchu.net/blog/removing-genesis-sidebars/](http://davidchu.net/blog/removing-genesis-sidebars/)
 * I know there are other sidebar plugins akin to Genesis Simple Sidebars, but for
   any theme, not just Genesis ones, and I would guess that they also have their
   own “interfering” hooks.
 * Dave
 *  [OrgSpring](https://wordpress.org/support/users/orgspring/)
 * (@orgspring)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/removing-sidebars-doesnt-work-in-code/#post-4077937)
 * In response to flamenco’s post. I was able to get it working with this code. 
   I had to change the priority and location of the action hook.
 *     ```
       add_action('get_header','os_change_genesis_sidebar', 11);  //11 used as priority to match woo connect genesis integration
       function os_change_genesis_sidebar() {
       	remove_action( 'genesis_sidebar', 'gencwooc_ss_do_sidebar' );	//special remove hook for when genesis simple sidebars & Genesis Woo Connect plugin is active
           }
       ```
   
 * You’ll see the woo connect genesis plugin file for genesis-simple-sidebars.php
   in the sp-plugins-integration folder. First few lines deals with the integration/

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

The topic ‘Removing Sidebars doesn't work in code’ is closed to new replies.

 * ![](https://ps.w.org/genesis-simple-sidebars/assets/icon-256x256.png?rev=1335778)
 * [Genesis Simple Sidebars](https://wordpress.org/plugins/genesis-simple-sidebars/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/genesis-simple-sidebars/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/genesis-simple-sidebars/)
 * [Active Topics](https://wordpress.org/support/plugin/genesis-simple-sidebars/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/genesis-simple-sidebars/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/genesis-simple-sidebars/reviews/)

 * 7 replies
 * 6 participants
 * Last reply from: [OrgSpring](https://wordpress.org/support/users/orgspring/)
 * Last activity: [11 years, 10 months ago](https://wordpress.org/support/topic/removing-sidebars-doesnt-work-in-code/#post-4077937)
 * Status: resolved