wordpress snippets last updated   : January 29, 2015
we now have 646 snippets

Add new column with media ID to media library

wordpress snippet

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

snippet :  PHPcopy
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 );

Did you like this post? If so please share it with your friends. Thanks!

  • Constantin

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

  • JustSomeBlogger

    Nice! Thank you!

    • http://wpsnipp.com Kevin Chard

      No problem glad I could help!