I was wondering if there was a way to unregister a widget that gets declared in the functions.php file of a parent theme from a child theme, I understand that the child's function.php file gets loaded first so I don't know how to unregister it when it hasn't been created yet.

Thanks all in advance!

2 Answers 2


Assuming the Parent Theme's Widget is registered at the widgets_init hook, all you need to do is wrap your unregister_widget() call inside of a function, hook that function into widgets_init, and give your hook a higher priority number than the Parent Theme's widgets_init-hooked function.

Assuming the Parent Theme hooks into widgets_init without giving a priority number, the function will default to 10. So, just give your hook call a priority of 11 or greater.


A priority of 11 might not work so try this in your child themes functions file:

add_action( 'widgets_init', 'unregister_a_widget', 99 );

function unregister_a_widget() {

    unregister_widget( 'Your_Widget_Class' );


Swap out Your_Widget_Class with the class for your widget.

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.