Working on a child theme. On the parent theme functions.php there is a 'widgets_init' action where four sidebars are regsitered. I need to remove three of those sidebars.

What is the propper way to do this?

I already tried :

1) creating a 'widgets_init' functions on the child theme (different function name) with higher priority, with only one 'register_sidebar'. Not working, the four sidebars are still there.

2) remove parent action with remove_action( 'widgets_init', 'wp_bootstrap_starter_widgets_init' ); Not working, the four sidebars are still there.

Then, I tried adding a custom function on the child theme for the 'widgets_init' action, and then, I do a "unregister_sidebar" for each of the sidebars I want to remove. This works, but I don't kmnow if is the best way.

I want to do it the RIGHT way.

  • You can't remove_action for a hook that hasn't been added yet. Note that a child theme functions.php loads before the parent theme. – Milo Jan 11 at 16:41
  • You have the right solution. It’s unregistering the sidebars. – Jacob Peattie Jan 11 at 18:12

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.