Archives

Easier Access to Media File from Media Library

Maybe it’s just me, but sometimes I’d link to grab an image’s file URL from the Media Library, but I can’t do it easily. This little snippet will add a link to the ‘row actions’ (“Edit | Delete Permanently | View”) for the File URL (as opposed the the attachment URL you’ll get with the ‘view’ link)

add_filter ('media_row_actions','add_direct_link', 10, 3 );
function add_direct_link( $actions, $post, $detached ) {
	$actions['file_url'] = '<a href="' . wp_get_attachment_url($post->ID) . '">Actual File</a>';
	return $actions;
}