Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to remove Main Sidebar, First and Second Front Page Widget areas in my child theme. Basically I don't want them to be shown up in Admin Panel.

I've placed that code into my function.php file. It's seems to not work:

function remove_some_widgets(){

    unregister_sidebar( 'Main Sidebar' );
    unregister_sidebar( 'First Front Page Widget Area' );
    unregister_sidebar( 'Secon Front Page Widget Area' );
}
add_action( 'widgets_init', 'remove_some_widgets', 11 );

I've got it from WordPress Codex but I think that was developed for Twenty Ten theme. Anyone knows the right code for Twenty Twelve parent theme. ?

Thanks for answers.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

The unregister_sidebar takes the ID, not the name:

<?php unregister_sidebar( $id ); ?> 

You'll need to do it like this:

<?php
function remove_some_widgets(){
    unregister_sidebar( 'sidebar-1' );
    unregister_sidebar( 'sidebar-2' );
    unregister_sidebar( 'sidebar-3' );
}
add_action( 'widgets_init', 'remove_some_widgets', 11 );
?>
share|improve this answer
    
That works perfectly. Thanks a lot! –  Andrewski Jun 1 '13 at 13:58
    
@Andrewski You're welcome :) Please accept the answer is this question is solved. –  Sven Jun 1 '13 at 14:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.