WP_Media_List_Table::get_columns()
Method of the class: WP_Media_List_Table{}
Hooks from the method
Return
String[]
. Array of column titles keyed by their column name.
Usage
$WP_Media_List_Table = new WP_Media_List_Table(); $WP_Media_List_Table->get_columns();
WP_Media_List_Table::get_columns() WP Media List Table::get columns code WP 6.6.2
public function get_columns() { $posts_columns = array(); $posts_columns['cb'] = '<input type="checkbox" />'; /* translators: Column name. */ $posts_columns['title'] = _x( 'File', 'column name' ); $posts_columns['author'] = __( 'Author' ); $taxonomies = get_taxonomies_for_attachments( 'objects' ); $taxonomies = wp_filter_object_list( $taxonomies, array( 'show_admin_column' => true ), 'and', 'name' ); /** * Filters the taxonomy columns for attachments in the Media list table. * * @since 3.5.0 * * @param string[] $taxonomies An array of registered taxonomy names to show for attachments. * @param string $post_type The post type. Default 'attachment'. */ $taxonomies = apply_filters( 'manage_taxonomies_for_attachment_columns', $taxonomies, 'attachment' ); $taxonomies = array_filter( $taxonomies, 'taxonomy_exists' ); foreach ( $taxonomies as $taxonomy ) { if ( 'category' === $taxonomy ) { $column_key = 'categories'; } elseif ( 'post_tag' === $taxonomy ) { $column_key = 'tags'; } else { $column_key = 'taxonomy-' . $taxonomy; } $posts_columns[ $column_key ] = get_taxonomy( $taxonomy )->labels->name; } /* translators: Column name. */ if ( ! $this->detached ) { $posts_columns['parent'] = _x( 'Uploaded to', 'column name' ); if ( post_type_supports( 'attachment', 'comments' ) ) { $posts_columns['comments'] = sprintf( '<span class="vers comment-grey-bubble" title="%1$s" aria-hidden="true"></span><span class="screen-reader-text">%2$s</span>', esc_attr__( 'Comments' ), /* translators: Hidden accessibility text. */ __( 'Comments' ) ); } } /* translators: Column name. */ $posts_columns['date'] = _x( 'Date', 'column name' ); /** * Filters the Media list table columns. * * @since 2.5.0 * * @param string[] $posts_columns An array of columns displayed in the Media list table. * @param bool $detached Whether the list table contains media not attached * to any posts. Default true. */ return apply_filters( 'manage_media_columns', $posts_columns, $this->detached ); }