wp_register_sidebar_widget() WP 1.0
Register an instance of a widget.
The default widget option is 'classname' that can be overridden.
The function can also be used to un-register widgets when $output_callback parameter is an empty string.
Basis of: wp_unregister_sidebar_widget()
Hooks from the function
Return
Null. Nothing.
Usage
wp_register_sidebar_widget( $id, $name, $output_callback, $options, ...$params );
- $id(int/string) (required)
- Widget ID.
- $name(string) (required)
- Widget display title.
- $output_callback(callable) (required)
- Run when widget is called.
- $options(array)
An array of supplementary widget options for the instance.
-
classname(string)
Class name for the widget's HTML container.
Default: shortened version of the output callback name - description(string)
Widget description for display in the widget administration panel and/or theme.
Default: array()
-
- ...$params(mixed) (required)
- Optional additional parameters to pass to the callback function when it's called.
Notes
- Global. Array. $wp_registered_widgets Uses stored registered widgets.
- Global. Array. $wp_registered_widget_controls Stores the registered widget controls (options).
- Global. Array. $wp_registered_widget_updates
- Global. Array. $_wp_deprecated_widgets_callbacks
Changelog
Since 2.2.0 | Introduced. |
Since 5.3.0 | Formalized the existing and already documented ...$params parameter by adding it to the function signature. |