register_widget

Register a widget.

Description

register_widget( (string) $widget_class ); 

Registers a WP_Widget widget

Parameters (1)

0. $widget_class (string)
The name of a class that extends WP_Widget

Usage

  1. if ( !function_exists( 'register_widget' ) ) { 
  2. require_once ABSPATH . WPINC . '/widgets.php'; 
  3.  
  4. // The name of a class that extends WP_Widget 
  5. $widget_class = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = register_widget($widget_class); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/widgets.php  
  1. function register_widget($widget_class) { 
  2. global $wp_widget_factory; 
  3.  
  4. $wp_widget_factory->register($widget_class);