What is the difference between wp_register_sidebar_widget and register_widget?

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.

Leave a Comment