Index: src/wp-includes/class-wp.php
===================================================================
--- src/wp-includes/class-wp.php	(revision 51357)
+++ src/wp-includes/class-wp.php	(working copy)
@@ -401,6 +401,7 @@
 		$headers       = array();
 		$status        = null;
 		$exit_required = false;
+		$date_format   = 'D, d M Y H:i:s';
 
 		if ( is_user_logged_in() ) {
 			$headers = array_merge( $headers, wp_get_nocache_headers() );
@@ -408,7 +409,7 @@
 			// Unmoderated comments are only visible for 10 minutes via the moderation hash.
 			$expires = 10 * MINUTE_IN_SECONDS;
 
-			$headers['Expires']       = gmdate( 'D, d M Y H:i:s', time() + $expires );
+			$headers['Expires']       = gmdate( $date_format, time() + $expires );
 			$headers['Cache-Control'] = sprintf(
 				'max-age=%d, must-revalidate',
 				$expires
@@ -447,13 +448,20 @@
 					)
 				)
 			) {
-				$wp_last_modified = mysql2date( 'D, d M Y H:i:s', get_lastcommentmodified( 'GMT' ), false );
+				$wp_last_modified_post    = mysql2date( $date_format, get_lastpostmodified( 'GMT' ), false );
+				$wp_last_modified_comment = mysql2date( $date_format, get_lastcommentmodified( 'GMT' ), false );
+
+				if ( strtotime( $wp_last_modified_post ) > strtotime( $wp_last_modified_comment ) ) {
+					$wp_last_modified = $wp_last_modified_post;
+				} else {
+					$wp_last_modified = $wp_last_modified_comment;
+				}
 			} else {
-				$wp_last_modified = mysql2date( 'D, d M Y H:i:s', get_lastpostmodified( 'GMT' ), false );
+				$wp_last_modified = mysql2date( $date_format, get_lastpostmodified( 'GMT' ), false );
 			}
 
 			if ( ! $wp_last_modified ) {
-				$wp_last_modified = gmdate( 'D, d M Y H:i:s' );
+				$wp_last_modified = gmdate( $date_format );
 			}
 
 			$wp_last_modified .= ' GMT';
Index: tests/phpunit/tests/feed/rss2.php
===================================================================
--- tests/phpunit/tests/feed/rss2.php	(revision 51357)
+++ tests/phpunit/tests/feed/rss2.php	(working copy)
@@ -494,4 +494,76 @@
 		);
 
 	}
+
+	/**
+	 * Test that Last-Modified in headers is properly updated from posts and comments where appropriate.
+	 *
+	 * @ticket 47968
+	 */
+	public function test_feed_last_modified_header() {
+		$last_week = gmdate( 'Y-m-d H:i:s', strtotime( '-1 week' ) );
+		$yesterday = gmdate( 'Y-m-d H:i:s', strtotime( '-1 day' ) );
+		$today     = gmdate( 'Y-m-d H:i:s' );
+
+		$post_id = $this->factory()->post->create(
+			array(
+				'post_date' => $last_week,
+			)
+		);
+
+		$filter_post_modified_last_week = function( $headers ) use ( $last_week ) {
+			$this->assertSame( strtotime( $headers['Last-Modified'] ), strtotime( $last_week ) );
+
+			return $headers;
+		};
+
+		add_filter( 'wp_headers', $filter_post_modified_last_week );
+
+		// Last modified by a post last week.
+		$this->go_to( '/?feed=rss2' );
+
+		$this->factory()->comment->create(
+			array(
+				'comment_post_ID' => $post_id,
+				'comment_date'    => $yesterday,
+			)
+		);
+
+		// Last modified by a comment yesterday, however, we are calling a feed without comments, so Last-Modified is still from last week's post.
+		$this->go_to( '/?feed=rss2' );
+
+		remove_filter( 'wp_headers', $filter_post_modified_last_week );
+
+		$filter_comment_modified_yesterday = function( $headers ) use ( $yesterday ) {
+			$this->assertSame( strtotime( $headers['Last-Modified'] ), strtotime( $yesterday ) );
+
+			return $headers;
+		};
+
+		add_filter( 'wp_headers', $filter_comment_modified_yesterday );
+
+		// Last modified by a comment yesterday, we are calling a feed with comments, so Last-Modified is from yesterday's comment.
+		$this->go_to( '/?feed=rss2&withcomments=1' );
+
+		remove_filter( 'wp_headers', $filter_comment_modified_yesterday );
+
+		$this->factory()->post->create(
+			array(
+				'post_date' => $today,
+			)
+		);
+
+		$filter_post_modified_today = function( $headers ) use ( $today ) {
+			$this->assertSame( strtotime( $headers['Last-Modified'] ), strtotime( $today ) );
+
+			return $headers;
+		};
+
+		add_filter( 'wp_headers', $filter_post_modified_today );
+
+		// Last modified by a post today, so that should be the Last-Modified datetime.
+		$this->go_to( '/?feed=rss2&withcomments=1' );
+
+		remove_filter( 'wp_headers', $filter_post_modified_today );
+	}
 }
