Index: tests/phpunit/tests/post/revisions.php
===================================================================
--- tests/phpunit/tests/post/revisions.php	(revision 26981)
+++ tests/phpunit/tests/post/revisions.php	(working copy)
@@ -338,4 +338,52 @@
 			$this->assertTrue( user_can( $author_user_id, 'read_post', $revision->ID ) );
 		}
 	}
+
+	/**
+	 * Preview changes on a published post makes all post meta "live"
+	 * @ticket 20299
+	 */
+	function test_meta_stored_to_preview_autosave(){
+
+		$editor_user_id = $this->factory->user->create( array( 'role' => 'editor' ) );
+
+		$user = new WP_User( $editor_user_id );
+
+		$postd = array(
+			'post_author'  => $editor_user_id,
+			'post_content' => 'the content',
+			'post_title'   => 'the title',
+			'post_status'  => 'publish',
+		);
+
+		wp_set_current_user( $editor_user_id );
+		$post_id = wp_insert_post( $postd );
+
+		add_filter( 'wp_post_revision_meta_keys', function( $keys ) {
+			$keys[] = 'publish_meta_test';
+			return $keys;
+		} );
+
+		// Add some post meta
+		update_post_meta( $post_id, 'publish_meta_test', 'original' );
+
+		// These two $_POST variables are required for wp_create_post_autosave
+		$_POST['post_ID']   = $post_id;
+		$_POST['post_type'] = 'post';
+
+		// Create an autosave
+		$id = wp_create_post_autosave( $post_id );
+
+		// Test that the preview meta is not set
+		$this->assertEquals( get_post_meta( $id, 'publish_meta_test', true ), 'original' );
+
+		wp_delete_post( $post_id );
+		wp_delete_post( $id );
+
+
+
+		wp_delete_post( $post_id );
+	}
+
+
 }
