WP_Widget::get_settings() WordPress Method
The WP_Widget::get_settings() method is used to get the settings for a particular widget. The settings are stored in an array and are retrieved by the get_option() function.
WP_Widget::get_settings() #
Retrieves the settings for all instances of the widget class.
Return
(array) Multi-dimensional array of widget instance settings.
Source
File: wp-includes/class-wp-widget.php
public function get_settings() { $settings = get_option( $this->option_name ); if ( false === $settings ) { if ( isset( $this->alt_option_name ) ) { $settings = get_option( $this->alt_option_name ); } else { // Save an option so it can be autoloaded next time. $this->save_settings( array() ); } } if ( ! is_array( $settings ) && ! ( $settings instanceof ArrayObject || $settings instanceof ArrayIterator ) ) { $settings = array(); } if ( ! empty( $settings ) && ! isset( $settings['_multiwidget'] ) ) { // Old format, convert if single widget. $settings = wp_convert_widget_settings( $this->id_base, $this->option_name, $settings ); } unset( $settings['_multiwidget'], $settings['__i__'] ); return $settings; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
2.8.0 | Introduced. |