Uses
Uses | Description |
---|---|
wp-includes/functions.php: wp_parse_args() | Merge user defined arguments into defaults array. |
PHP5 constructor.
(string) (Optional) Base ID for the widget, lowercase and unique. If left empty, a portion of the widget's class name will be used. Has to be unique.
(string) (Optional) Name for the widget displayed on the configuration page.
(array) (Optional) Widget options. See wp_register_sidebar_widget() for information on accepted arguments.
Default value: array()
(array) (Optional) Widget control options. See wp_register_widget_control() for information on accepted arguments.
Default value: array()
File: wp-includes/class-wp-widget.php
public function __construct( $id_base, $name, $widget_options = array(), $control_options = array() ) { $this->id_base = empty( $id_base ) ? preg_replace( '/(wp_)?widget_/', '', strtolower( get_class( $this ) ) ) : strtolower( $id_base ); $this->name = $name; $this->option_name = 'widget_' . $this->id_base; $this->widget_options = wp_parse_args( $widget_options, array( 'classname' => $this->option_name, 'customize_selective_refresh' => false, ) ); $this->control_options = wp_parse_args( $control_options, array( 'id_base' => $this->id_base ) ); }
Version | Description |
---|---|
2.8.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_widget/__construct