CodingCereal > How To > Add Caption and Description Columns to Media Page

Add Caption and Description Columns to Media Page

This is a short script on how to add new columns to the media page.

add_filter('manage_media_columns', 'add_media_column');
function add_media_column($columns) {
    $columns['caption'] = 'Caption';
    $columns['description'] = 'description';
    return $columns;
}

add_action('manage_media_custom_column', 'manage_attachment_media_column', 10, 2);
function manage_attachment_media_column($column_name, $id) {
	$get_post = get_post($id);
    switch($column_name) {
		case 'caption':
			echo $get_post->post_excerpt; 
			break;
		case 'description':
			echo $get_post->post_content; 
			break;
		default:
			break;
    }
}

Here is the output:

Enjoy!