WP_Widget_Factory::get_widget_key() WordPress Method
The WP_Widget_Factory::get_widget_key() is a Wordpress method that allows you to retrieve the widget key for a given widget. This can be useful if you need to programmatically access a widget's settings.
WP_Widget_Factory::get_widget_key( string $id_base ) #
Returns the registered key for the given widget type.
Parameters
- $id_base
(string)(Required)Widget type ID.
Return
(string)
Source
File: wp-includes/class-wp-widget-factory.php
public function get_widget_key( $id_base ) { foreach ( $this->widgets as $key => $widget_object ) { if ( $widget_object->id_base === $id_base ) { return $key; } } return ''; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
5.8.0 | Introduced. |