0

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.

1

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 );
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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