diff --git src/wp-includes/media.php src/wp-includes/media.php
index dbc9c7d..e80baab 100644
--- src/wp-includes/media.php
+++ src/wp-includes/media.php
@@ -1699,7 +1699,16 @@ function gallery_shortcode( $attr ) {
 	if ( is_feed() ) {
 		$output = "\n";
 		foreach ( $attachments as $att_id => $attachment ) {
-			$output .= wp_get_attachment_link( $att_id, $atts['size'], true ) . "\n";
+			if ( ! empty( $atts['link'] ) ) {
+				if( 'none' === $atts['link'] ) {
+					$output .= wp_get_attachment_image( $att_id, $atts['size'], false, $attr );
+				} else {
+					$output .= wp_get_attachment_link( $att_id, $atts['size'], false );
+				}
+			} else {
+				$output .= wp_get_attachment_link( $att_id, $atts['size'], true );
+			}
+			$output .= "\n";
 		}
 		return $output;
 	}
diff --git tests/phpunit/tests/media.php tests/phpunit/tests/media.php
index 392c039..9dc6a49 100644
--- tests/phpunit/tests/media.php
+++ tests/phpunit/tests/media.php
@@ -2062,6 +2062,35 @@ EOF;
 		$attachment_id = wp_insert_attachment( $data, '', 0 );
 		$this->assertSame( 0, $attachment_id );
 	}
+
+        /**
+         * @ticket 22101
+         */
+        function test_gallery_shortcode_when_is_feed_true() {
+
+		$this->go_to( '/?feed=rss2' ); 
+
+		// Default: Links to image attachment page url 
+		$actual = gallery_shortcode( array(
+			'ids'      => self::$large_id,
+                ) );
+		$this->assertContains( '?attachment_id=', $actual );
+
+		// File: Links to image file url 
+		$actual = gallery_shortcode( array(
+			'ids'	=> self::$large_id,
+			'link'	=> 'file',
+		) );
+		$this->assertTrue( 2 == substr_count( $actual, '.png' ) );
+
+		// None: Does not link
+		$actual = gallery_shortcode( array(
+                        'ids'	=> self::$large_id,
+			'link'	=> 'none',
+		) );
+		$this->assertFalse( strpos( $actual, '<a ' ) );
+        }
+
 }
 
 /**
