Index: src/wp-includes/post.php
===================================================================
--- src/wp-includes/post.php	(revision 30055)
+++ src/wp-includes/post.php	(working copy)
@@ -3100,7 +3100,7 @@
 			return 0;
 		}
 
-		$guid = get_post_field( 'guid', $post_ID );
+		$guid = get_post_field( 'guid', $post_ID, 'raw' );
 		$previous_status = get_post_field('post_status', $post_ID );
 	} else {
 		$previous_status = 'new';
@@ -3393,7 +3393,7 @@
 		}
 	}
 
-	$current_guid = get_post_field( 'guid', $post_ID );
+	$current_guid = get_post_field( 'guid', $post_ID, 'raw' );
 
 	// Set GUID.
 	if ( ! $update && '' == $current_guid ) {
Index: tests/phpunit/tests/post/guid.php
===================================================================
--- tests/phpunit/tests/post/guid.php	(revision 0)
+++ tests/phpunit/tests/post/guid.php	(working copy)
@@ -0,0 +1,41 @@
+<?php
+
+/**
+ * @group post
+ * @ticket TODO
+ */
+class Tests_Post_GUID extends WP_UnitTestCase {
+	function setUp() {
+		parent::setUp();
+		$this->author_id = $this->factory->user->create( array( 'role' => 'editor' ) );
+		$this->old_current_user = get_current_user_id();
+		wp_set_current_user( $this->author_id );
+
+	}
+
+	function tearDown() {
+		wp_set_current_user( $this->old_current_user );
+		parent::tearDown();
+	}
+
+	/**
+	 * Tests that the GUID is not improperly escaped
+	 *
+	 */
+	function test_wp_insert_post() {
+		$guid = 'http://www.wordpress.dev/?post_type=changeset&p=57';
+		$id = wp_insert_post(array(
+			'post_status' => 'publish',
+			'post_title' => "Test",
+			'post_content' => "Test",
+			'post_excerpt' => "Test",
+			'guid' => $guid,
+			'post_type' => 'post',
+			'slashed' => false,
+		));
+		$post = get_post( $id );
+		$this->assertEquals( $guid, $post->guid);
+
+	}
+
+}
