wppaste
WordPress

WP_Media_List_Table

Since
3.1.0
Source
wp-admin/includes/class-wp-media-list-table.php:17
Core class used to implement displaying media items in a list table.

Compatibility

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

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

Properties · 3

$comment_pending_countarrayprotected
Holds the number of pending comments for each post.
$detachedboolprivate
Whether the list table is for detached media.
$is_trashboolprivate
Whether the list table is for trash.

Methods · 24

Source code

class WP_Media_List_Table extends WP_List_Table {	/**	 * Holds the number of pending comments for each post.	 *	 * @since 4.4.0	 * @var array	 */	protected $comment_pending_count = array(); 	/**	 * Whether the list table is for detached media.	 *	 * @since 3.1.0	 * @var bool	 */	private $detached; 	/**	 * Whether the list table is for trash.	 *	 * @since 3.1.0	 * @var bool	 */	private $is_trash; 	/**	 * Constructor.	 *	 * @since 3.1.0	 *	 * @see WP_List_Table::__construct() for more information on default arguments.	 *	 * @param array $args An associative array of arguments.	 */	public function __construct( $args = array() ) {		$this->detached = ( isset( $_REQUEST['attachment-filter'] ) && 'detached' === $_REQUEST['attachment-filter'] ); 		$this->modes = array(			'list' => __( 'List view' ),			'grid' => __( 'Grid view' ),		); 		parent::__construct(			array(				'plural' => 'media',				'screen' => $args['screen'] ?? null,			)		);	} 	/**	 * Checks if the current user has permissions to upload files.	 *	 * @since 3.1.0	 *	 * @return bool Whether the user can upload files.	 */	public function ajax_user_can() {		return current_user_can( 'upload_files' );	} 	/**	 * Prepares the list of items for displaying.	 *	 * @since 3.1.0	 *	 * @global string   $mode                  List table view mode.	 * @global WP_Query $wp_query              WordPress Query object.	 * @global array    $post_mime_types       An array of post mime types.	 * @global array    $avail_post_mime_types An array of available post mime types.	 */	public function prepare_items() {		global $mode, $wp_query, $post_mime_types, $avail_post_mime_types; 		$mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode']; 		/*		 * Exclude attachments scheduled for deletion in the next two hours		 * if they are for zip packages for interrupted or failed updates.		 * See File_Upload_Upgrader class.

Changelog

Introduced in 3.1.0. One change between 6.7.7 and 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.

7.1.0
Method get_primary_column_aria_label() added.verified against source
3.1.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 7.0.4 tag, from src/wp-admin/includes/class-wp-media-list-table.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.