diff --git a/src/wp-includes/media-template.php b/src/wp-includes/media-template.php
index 0a07b5619f..caa98c313a 100644
--- a/src/wp-includes/media-template.php
+++ b/src/wp-includes/media-template.php
@@ -511,11 +511,17 @@ function wp_print_media_templates() {
 			</div>

 			<div class="actions">
-				<a class="view-attachment" href="{{ data.link }}"><?php _e( 'View attachment page' ); ?></a>
-				<# if ( data.can.save ) { #> |
+				<?php if ( ! apply_filters( 'disable_attachment_page_link', false ) ) : ?>
+					<# if ( data.link ) { #>
+						<a class="view-attachment" href="{{ data.link }}"><?php _e( 'View attachment page' ); ?></a>
+					<# } #>
+					<span class="links-separator">|</span>
+				<?php endif; ?>
+				<# if ( data.can.save ) { #>
 					<a href="{{ data.editLink }}"><?php _e( 'Edit more details' ); ?></a>
+					<span class="links-separator">|</span>
 				<# } #>
-				<# if ( ! data.uploading && data.can.remove ) { #> |
+				<# if ( ! data.uploading && data.can.remove ) { #>
 					<?php if ( MEDIA_TRASH ) : ?>
 						<# if ( 'trash' === data.status ) { #>
 							<button type="button" class="button-link untrash-attachment"><?php _e( 'Restore from Trash' ); ?></button>
