WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What's the difference between them and when should we use each one ?

I'm using wp_register_sidebar_widget right now and it's working fine but I've seen a lot of tutorials online on how to create a widget using register_widget and a class, most of my widgets doesn't need options so should I stick to wp_register_sidebar_widget or should I use register_widget even if I don't have a form ?

thanks in advance.

share|improve this question
up vote 9 down vote accepted

wp_register_sidebar_widget() is part of the old widgets API. Sidebar widgets used to be built procedurally ... in a non-reusable fashion (i.e. you could only ever have one of each).

register_widget() was introduced with the new Widgets API and takes an object/class as an input rather than actual widget parameters. WordPress can instantiate as many copies of this widget as you need, allowing you to have several instances of the exact same widget.

You should be using individual widget classes and register_widget() even if your widget doesn't have an input form.

share|improve this answer
thank you very much :) – Pierre Apr 3 '12 at 5:17

Your Answer


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.