Title: Remove sidebar
Last modified: August 20, 2016

---

# Remove sidebar

 *  [Arbiz](https://wordpress.org/support/users/arbiz/)
 * (@arbiz)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/remove-sidebar-8/)
 * I need to remove the primary side bar of my plugin and replace it with dynamic
   content – on a single page only –
    NB: I don’t want to modify any theme specific
   files such as functions.php or sidebar.php, I’m hoping there’s an action or filter
   hook capable of doing this. Thanks for your help!

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

 *  [channeleaton](https://wordpress.org/support/users/channeleaton/)
 * (@channeleaton)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/remove-sidebar-8/#post-2940044)
 * To do it on a specific page (if, in fact, it is the actual post-type ‘page’) 
   you will need to create a [Page Template](http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates).
 *  Thread Starter [Arbiz](https://wordpress.org/support/users/arbiz/)
 * (@arbiz)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/remove-sidebar-8/#post-2940073)
 * Hi
    Thanks for your reply but I’m trying to remove the sidebar from within a 
   plugin so i can’t create a template page. Let me try to explain: the main plugin
   page includes some php code (linked to mysql). Depending on content received 
   from database the sidebar should be removed and replaced. I was hoping there 
   was a filter or action hook to do this from within my plugin page..
 *  [vhf](https://wordpress.org/support/users/kortchnoi/)
 * (@kortchnoi)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/remove-sidebar-8/#post-2940089)
 * Would it be possible to retrieve all registered sidebars’ ID with `wp_get_sidebars_widgets()`
   and the unregister them with `unregister_sidebar( $id )` ?
 * [EDIT]
    I gave it a quick test, it should work.
 *     ```
       $registered_sidebars = wp_get_sidebars_widgets();
       foreach( $registered_sidebars as $sidebar_name => $sidebar_widgets ) {
       	if( $sidebar_name != 'wp_inactive_widgets' ) unregister_sidebar( $sidebar_name );
       }
       ```
   
 *  Thread Starter [Arbiz](https://wordpress.org/support/users/arbiz/)
 * (@arbiz)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/remove-sidebar-8/#post-2940096)
 * Hi
    That sounded great…however when I run the code, my sidebar is still there…
   wp_get_sidebars_widgets() does return the list of widgets but unregister_sidebar()
   doesn’t seem to do anything. Did you actually manage to remove your sidebar using
   unregister_sidebar? Thanks for your help.
 *  [vhf](https://wordpress.org/support/users/kortchnoi/)
 * (@kortchnoi)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/remove-sidebar-8/#post-2940100)
 * Yeah, I managed to remove a sidebar I registred…
 * Try placing this code at the end of theme’s functions.php. If it works there,
   it is probably also possible from within a plugin. Not sure, though.
 *  Thread Starter [Arbiz](https://wordpress.org/support/users/arbiz/)
 * (@arbiz)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/remove-sidebar-8/#post-2940105)
 * well that’s very strange, I’ve added the code in functions.php as suggested. 
   Again the list of widgets is returned but the sidebar is not removed. I tested
   with twenty-eleven theme.
    I’m lost here…

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

The topic ‘Remove sidebar’ is closed to new replies.

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 6 replies
 * 3 participants
 * Last reply from: [Arbiz](https://wordpress.org/support/users/arbiz/)
 * Last activity: [13 years, 10 months ago](https://wordpress.org/support/topic/remove-sidebar-8/#post-2940105)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
