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

Leave a comment