wppaste
WordPress

WP_Widget_Media

Since
4.8.0
Source
wp-includes/widgets/class-wp-widget-media.php:17
Core class that implements a media widget.

Compatibility

WordPress
since 4.8.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Hooks and filters fired · 3

Every hook that fires from inside WP_Widget_Media, in the order it appears in the class, grouped by the method that fires it.

Properties · 4

$l10narraypublic
Translation labels.
$registeredboolprotected
Whether or not the widget has been registered yet.
$default_descriptionstringprotected static
The default widget description.
$l10n_defaultsstring[]protected static
The default localized strings used by the widget.

Methods · 17

Source code

abstract class WP_Widget_Media extends WP_Widget { 	/**	 * Translation labels.	 *	 * @since 4.8.0	 * @var array	 */	public $l10n = array(		'add_to_widget'              => '',		'replace_media'              => '',		'edit_media'                 => '',		'media_library_state_multi'  => '',		'media_library_state_single' => '',		'missing_attachment'         => '',		'no_media_selected'          => '',		'add_media'                  => '',	); 	/**	 * Whether or not the widget has been registered yet.	 *	 * @since 4.8.1	 * @var bool	 */	protected $registered = false; 	/**	 * The default widget description.	 *	 * @since 6.0.0	 * @var string	 */	protected static $default_description = ''; 	/**	 * The default localized strings used by the widget.	 *	 * @since 6.0.0	 * @var string[]	 */	protected static $l10n_defaults = array(); 	/**	 * Constructor.	 *	 * @since 4.8.0	 *	 * @param string $id_base         Base ID for the widget, lowercase and unique.	 * @param string $name            Name for the widget displayed on the configuration page.	 * @param array  $widget_options  Optional. Widget options. See wp_register_sidebar_widget() for	 *                                information on accepted arguments. Default empty array.	 * @param array  $control_options Optional. Widget control options. See wp_register_widget_control()	 *                                for information on accepted arguments. Default empty array.	 */	public function __construct( $id_base, $name, $widget_options = array(), $control_options = array() ) {		$widget_opts = wp_parse_args(			$widget_options,			array(				'description'                 => self::get_default_description(),				'customize_selective_refresh' => true,				'show_instance_in_rest'       => true,				'mime_type'                   => '',			)		); 		$control_opts = wp_parse_args( $control_options, array() ); 		$this->l10n = array_merge( self::get_l10n_defaults(), array_filter( $this->l10n ) ); 		parent::__construct(			$id_base,			$name,			$widget_opts,			$control_opts		);	} 	/**	 * Add hooks while registering all widget instances of this widget class.

Changelog

Introduced in 4.8.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.8.8 tag, from src/wp-includes/widgets/class-wp-widget-media.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.