How to override parent theme actions

admin2025-06-04  3

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.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749021081a315685.html

最新回复(0)