Add new column with media ID to media library

Adding this snippet to the functions.php of your wordpress theme will add a new column within the media library with the attachment ID.

function column_id($columns) {
    $columns['colID'] = __('ID');
    return $columns;
add_filter( 'manage_media_columns', 'column_id' );

function column_id_row($columnName, $columnID){
    if($columnName == 'colID'){
       echo $columnID;
add_filter( 'manage_media_custom_column', 'column_id_row', 10, 2 );

Comments  Leave a Reply

  1. nice!!! thanks a lot!

  2. JustSomeBlogger April 20, 2014 at 5:36 pm

    Nice! Thank you!

    1. No problem glad I could help!

  3. great piece of code.
    any way you can make the list sortable by this column?

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!