WordPress at a glance

register_widget() WP 1.0

Register a widget Registers a WP_Widget widget

Registers a WP_Widget widget

  • See: WP_Widget
  • Global. WP_Widget_Factory. $wp_widget_factory
  • Since 4.6.0 Updated the $widget parameter to also accept a WP_Widget instance object instead of simply a WP_Widget subclass name.

No Hooks.


Nothing (null).


register_widget( $widget );
$widget(string/WP_Widget) (required)
Either the name of a WP_Widget subclass or an instance of a WP_Widget subclass.

Code of register widget: wp-includes/widgets.php WP 5.2.1

function register_widget( $widget ) {
	global $wp_widget_factory;

	$wp_widget_factory->register( $widget );

Related Functions

From tag: Sidebar (widgets)

No comments
    Hello, !     Log In . Register