Skip to content

Instantly share code, notes, and snippets.

@tahirtaous
Created January 8, 2015 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tahirtaous/a3538e181bb577b241e8 to your computer and use it in GitHub Desktop.
Save tahirtaous/a3538e181bb577b241e8 to your computer and use it in GitHub Desktop.
WordPress : Unregistering Parent Theme Sidebar in Child Theme
// Remove 2012 default sidebar widgets from admin area
// http://codex.wordpress.org/Function_Reference/unregister_sidebar
// following code will remove/unregister 2012 sidebars from admin area
// you can unregister any sidebar just replave sidebar-1 sidebar-2 and sidebar-3 with your sidebar id. you can find sidebar id's
// in parent theme's functions.php file
// http://codex.wordpress.org/Function_Reference/unregister_sidebar for more details
function remove_some_widgets(){
// Unregister some of the TwentyTen sidebars
unregister_sidebar( 'sidebar-1' );
unregister_sidebar( 'sidebar-2' );
unregister_sidebar( 'sidebar-3' );
}
add_action( 'widgets_init', 'remove_some_widgets', 11 );
@tahirtaous
Copy link
Author

Above code will un register sidebar of any theme and hide sidebars in WordPress dashboard.
I created a 2012 child theme and added above code in 2012 child theme's functions.php file to remove default 2012 widget from admin area.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment