wppaste
WordPress

WP_Widget_Media_Gallery

Since
4.9.0
Source
wp-includes/widgets/class-wp-widget-media-gallery.php:18
Core class that implements a gallery widget.

Compatibility

WordPress
since 4.9.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 · 1

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

Methods · 6

Source code

class WP_Widget_Media_Gallery extends WP_Widget_Media { 	/**	 * Constructor.	 *	 * @since 4.9.0	 */	public function __construct() {		parent::__construct(			'media_gallery',			__( 'Gallery' ),			array(				'description' => __( 'Displays an image gallery.' ),				'mime_type'   => 'image',			)		); 		$this->l10n = array_merge(			$this->l10n,			array(				'no_media_selected' => __( 'No images selected' ),				'add_media'         => _x( 'Add Images', 'label for button in the gallery widget; should not be longer than ~13 characters long' ),				'replace_media'     => '',				'edit_media'        => _x( 'Edit Gallery', 'label for button in the gallery widget; should not be longer than ~13 characters long' ),			)		);	} 	/**	 * Get schema for properties of a widget instance (item).	 *	 * @since 4.9.0	 *	 * @see WP_REST_Controller::get_item_schema()	 * @see WP_REST_Controller::get_additional_fields()	 * @link https://core.trac.wordpress.org/ticket/35574	 *	 * @return array Schema for properties.	 */	public function get_instance_schema() {		$schema = array(			'title'          => array(				'type'                  => 'string',				'default'               => '',				'sanitize_callback'     => 'sanitize_text_field',				'description'           => __( 'Title for the widget' ),				'should_preview_update' => false,			),			'ids'            => array(				'type'              => 'array',				'items'             => array(					'type' => 'integer',				),				'default'           => array(),				'sanitize_callback' => 'wp_parse_id_list',			),			'columns'        => array(				'type'    => 'integer',				'default' => 3,				'minimum' => 1,				'maximum' => 9,			),			'size'           => array(				'type'    => 'string',				'enum'    => array_merge( get_intermediate_image_sizes(), array( 'full', 'custom' ) ),				'default' => 'thumbnail',			),			'link_type'      => array(				'type'                  => 'string',				'enum'                  => array( 'post', 'file', 'none' ),				'default'               => 'post',				'media_prop'            => 'link',				'should_preview_update' => false,			),			'orderby_random' => array(				'type'                  => 'boolean',				'default'               => false,				'media_prop'            => '_orderbyRandom',				'should_preview_update' => false,			),

Changelog

Introduced in 4.9.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.7.7 tag, from src/wp-includes/widgets/class-wp-widget-media-gallery.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.