diff --git src/wp-includes/post.php src/wp-includes/post.php
index 98ad57fbd0..b09795c382 100644
--- src/wp-includes/post.php
+++ src/wp-includes/post.php
@@ -3451,12 +3451,20 @@ function wp_insert_post( $postarr, $wp_error = false ) {
 		$post_date_gmt = $postarr['post_date_gmt'];
 	}
 
-	if ( $update || '0000-00-00 00:00:00' == $post_date ) {
-		$post_modified     = current_time( 'mysql' );
-		$post_modified_gmt = current_time( 'mysql', 1 );
+	// Set the post modified date.
+	if ( empty( $postarr['post_modified'] ) || '0000-00-00 00:00:00' === $postarr['post_modified'] ) {
+		if ( empty( $postarr['post_modified_gmt'] ) || '0000-00-00 00:00:00' === $postarr['post_modified_gmt'] ) {
+			$post_modified = $update ? current_time( 'mysql' ) : $post_date;
+		} else {
+			$post_modified = get_date_from_gmt( $postarr['post_modified_gmt'] );
+		}
+	}
+
+	// Set the GMT version of the post modified date.
+	if ( empty( $postarr['post_modified_gmt'] ) || '0000-00-00 00:00:00' === $postarr['post_modified_gmt'] ) {
+		$post_modified_gmt = $update ? current_time( 'mysql', 1 ) : $post_date_gmt;
 	} else {
-		$post_modified     = $post_date;
-		$post_modified_gmt = $post_date_gmt;
+		$post_modified_gmt = $postarr['post_modified_gmt'];
 	}
 
 	if ( 'attachment' !== $post_type ) {
diff --git tests/phpunit/tests/post/wpInsertPost.php tests/phpunit/tests/post/wpInsertPost.php
index d459d9493d..f48fabf830 100644
--- tests/phpunit/tests/post/wpInsertPost.php
+++ tests/phpunit/tests/post/wpInsertPost.php
@@ -277,4 +277,23 @@ class Tests_WPInsertPost extends WP_UnitTestCase {
 		$this->assertSame( $expected, $actual );
 	}
 
+	/**
+	 * @ticket 41227
+	 */
+	public function test_can_set_post_modified_fields_on_post_update() {
+		$date    = new DateTime( '-2 hours', new DateTimeZone( 'UTC' ) );
+		$post_id = self::factory()->post->create( array(
+			'post_status' => 'publish',
+			'post_date'   => $date->format( 'Y-m-d H:i:s' ),
+		) );
+
+		$date->modify( '+1 hour' );
+		$modified_format = $date->format( 'Y-m-d H:i:s' );
+		wp_update_post( array(
+			'ID'                => $post_id,
+			'post_modified_gmt' => $modified_format,
+		) );
+
+		$this->assertEquals( $modified_format, get_post( $post_id )->post_modified_gmt );
+	}
 }
