"Uploaded By" Column in the Media Library
Adds a column to the Media Library list view showing who uploaded each file, with a link to see everything that person uploaded.
Opens WPIDE on
Code
add_filter( 'manage_upload_columns', function ( $columns ) {
$columns['wpide_uploader'] = 'Uploaded by';
return $columns;
} );
add_action( 'manage_media_custom_column', function ( $column, $attachment_id ) {
if ( 'wpide_uploader' !== $column ) {
return;
}
$author = get_userdata( (int) get_post_field( 'post_author', $attachment_id ) );
if ( ! $author ) {
echo '—';
return;
}
echo '<a href="' . esc_url( add_query_arg( array( 'mode' => 'list', 'author' => $author->ID ), admin_url( 'upload.php' ) ) ) . '">' . esc_html( $author->display_name ) . '</a>';
}, 10, 2 );
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.