I'm woking on a chid theme for Ohsik. I'm trying to unregister a sidebar, but nothing is working

Here's my function.php child theme code:

function unregister_footer_sidebar() {
unregister_sidebar( 'sidebar-2' );
add_action( 'widgets_init','unregister_footer_sidebar',11);
add_action( 'widgets_init', 'ohsik_widgets_init',12);

What am I doing wrong? Any suggestions to solve the problem?

1 Answer 1


This line is your problem

 add_action( 'widgets_init', 'ohsik_widgets_init', 12);

You are deregistering your sidebar correctly. For some reason you are registering it, or something. I don't see the need or use for this.

The other possibility that I'm thinking of for using this code is that somewhere you are registering your own custom sidebars.

If that is the case, you are most probably reusing the ID of the sidebar you have deregistered. Try changing the ID to 12 of your new sidebar. You can not reuse ID's. All ID's needs to be unique

  • You mean that I am de-registering and then re-registering it again? I tried to take off the last line, but the sidebar is still there... I didn't register any new sidebar, it's just the sidebar-1 and sidebar-2 coming from the parent theme
    – fran p.
    Jun 5, 2014 at 9:43
  • I thought I had to recall the parent's theme widgets_init but I was wrong. The code without the last line works, as @Pieter suggested.
    – fran p.
    Jun 5, 2014 at 9:52
  • Glad you got it working and learned something :). Enjoy Jun 5, 2014 at 10:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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