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.
$detachedprivate$is_trashprivate
Methods · 24
- __construct()Constructor.
- ajax_user_can()
- prepare_items()
- get_views()
- get_bulk_actions()
- extra_tablenav()
- current_action()
- has_items()
- no_items()
- views()Overrides parent views to use the filter bar display.
- get_columns()
- get_sortable_columns()
- column_cb()Handles the checkbox column output.
- column_title()Handles the title column output.
- column_author()Handles the author column output.
- column_desc()Handles the description column output.
- column_date()Handles the date column output.
- column_parent()Handles the parent column output.
- column_comments()Handles the comments column output.
- column_default()Handles output for the default column.
- display_rows()Generates the list table rows.
- get_default_primary_column_name()Gets the name of the default primary column.
- _get_row_actions()
- handle_row_actions()Generates and displays row action links.
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(); private $detached; 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' => isset( $args['screen'] ) ? $args['screen'] : null, ) ); } /** * @return bool */ public function ajax_user_can() { return current_user_can( 'upload_files' ); } /** * @global string $mode List table view mode. * @global WP_Query $wp_query WordPress Query object. * @global array $post_mime_types * @global array $avail_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. */ $not_in = array(); $crons = _get_cron_array(); if ( is_array( $crons ) ) { foreach ( $crons as $cron ) { if ( isset( $cron['upgrader_scheduled_cleanup'] ) ) { $details = reset( $cron['upgrader_scheduled_cleanup'] ); if ( ! empty( $details['args'][0] ) ) { $not_in[] = (int) $details['args'][0]; } } } } if ( ! empty( $_REQUEST['post__not_in'] ) && is_array( $_REQUEST['post__not_in'] ) ) { $not_in = array_merge( array_values( $_REQUEST['post__not_in'] ), $not_in ); }Changelog
Introduced in 3.1.0. One change between 6.7.7 and 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 source3.1.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 6.7.7 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.