Add New Column with Media ID to Media Library

Snippets by IsItWP

Do you want to add a new column for media ID within the media library of your WordPress website? While there’s probably a plugin for this, we have created a quick code snippet that you can use to add new column with media ID to media library in WordPress.


All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:

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 );

Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly add code snippets in WordPress, so you don’t accidentally break your site.

If you liked this code snippet, please consider checking out our other articles on the site like: 11 best WordPress slider plugins and how to add a portfolio to your WordPress website.

Comments   Leave a Reply

  1. Is this code tweakable to indicate in a column row if an image is being used somewhere as a featured image?

  2. nice!!! thanks a lot!

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

    Nice! Thank you!

    1. No problem glad I could help!

  4. 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!