Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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!

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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.

share|improve this answer
    
Thanks that did the trick! –  javiervd Jun 6 '11 at 13:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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