Serves as a utility method for adding widgets to the registered widgets global.
Source
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();
}
}
Changelog
Version | Description |
---|---|
2.8.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.