WordPress at a glance
function is not described

WP_Widget_Factory::_register_widgets() public WP 2.8.0

Serves as a utility method for adding widgets to the registered widgets global.

{} It's a method of the class: WP_Widget_Factory{}

No Hooks.

Return

null. Nothing.

Usage

$WP_Widget_Factory = new WP_Widget_Factory();
$WP_Widget_Factory->_register_widgets();

Notes

  • Global. Array. $wp_registered_widgets

Changelog

Since 2.8.0 Introduced.

Code of WP_Widget_Factory::_register_widgets() WP 5.7.2

<?php
public function _register_widgets() {
	global $wp_registered_widgets;
	$keys       = array_keys( $this->widgets );
	$registered = array_keys( $wp_registered_widgets );
	$registered = array_map( '_get_widget_id_base', $registered );

	foreach ( $keys as $key ) {
		// Don't register new widget if old widget with the same id is already registered.
		if ( in_array( $this->widgets[ $key ]->id_base, $registered, true ) ) {
			unset( $this->widgets[ $key ] );
			continue;
		}

		$this->widgets[ $key ]->_register();
	}
}